Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #20446
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: State and the standard ... |
| Date | 2013-03-08 14:41 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2013Mar8.154137@mips.complang.tuwien.ac.at> (permalink) |
| References | (5 earlier) <kguaao$snf$1@online.de> <2013Mar3.155647@mips.complang.tuwien.ac.at> <kh0g48$s4e$1@online.de> <2013Mar7.190415@mips.complang.tuwien.ac.at> <khbbg4$pnn$1@online.de> |
Bernd Paysan <bernd.paysan@gmx.de> writes:
>Anton Ertl wrote:
>>>: defers ( "name" -- ) ' defer@ compile, ; immediate compile-only
>>>
>>>is actually not correct. It should use that ]] literal execute [[ thing.
>>
>> So you found a place where the equivalence matters, and it was not
>> even written by me. Maybe it is not so academic after all. The
>> definition of DEFERS used to be correct. By making COMPILE, incorrect
>> DEFERS becaome incorrect. The mistake is not in DEFERS, but in the
>> change to COMPILE,.
>
>No, the thing does not cause any problems at all.
Yet.
> It shows that the
>equivalence for all practical purposes is correct, and your concern is
>academical.
Well, then why do you want to break that equivalence?
>You wouldn't assign a word with special compilation semantics
>to a deferred word, because it already would be broken that way.
Depends on what you expect. I guess you are thinking of a changeable
SYNONYM. I would hav thought that your universal xt and broken
"COMPILE," are intended to achieve that with an unchanged DEFER (just
like for the interpreter loop). If it does not achieve that, maybe
your concepts are not as good as you think.
OTOH, I don't expect DEFER to be a changeable SYNONYM, just like I
don't expect ALIAS to be a SYNONYM. I would just define a new word
for changeable synonyms, and that may or may not be tied to your ideas
about xts (preferably it would not depend on them).
Here you suggest a version that depends on them:
>: [defer] ( "name" -- )
> defer [: >body @ compile, ;] set-compiler ;
But it would be just as possible to write a [defer] without breaking
"COMPILE,", or (with a different interface) to write it in Gforth
0.7.0 (you would either pass the name, the nt or the xt and ct to the
IS replacement).
However, looking at the example again, I expect a deferred word to
bind at run-time, not at deferred-word compilation like your [DEFER]
does. I have not seen an example where such a changeable synonym that
binds at compile time when it is compiled, and at run-time when it is
interpreted, is useful.
The " example is not convincing, because you cannot use S" and C"
interchangeably (different stack effects), so switching them around
dynamically makes no sense. What you try to achieve with that can be
achieved already with SYNONYM and search order.
[...]
>>>The same thing for the OOP early binding, because the vtable also can only
>>>do EXECUTE, and therefore, COMPILE, would be wrong.
>>
>> And another example.
>
>But still, it does not cause any problems. This is because the methods are
>actually just :noname definitions which don't have any special compilation
>semantics. Only if they had, it would be a potential problem. You might
>want something like [method] to create such a selector, which then would
>allow you to define compiler macro methods (there's a place for them,
>BerndOOF has several).
So you can think of potential problems. If combined words are used
more commonly than now (and I guess you would be among the frequent
users), the problems will eventually show up in reality.
>Yes. But on the other hand, IMHO this equivalence is an artificial one
Why do you think so?
Looking at the DEFERS and [BIND]/SUPER/:: examples, it seems pretty
natural; did you even consider for one second that you should write
"POSTPONE literal POSTPONE execute" instead of "COMPILE," when you
originally wrote that code?
> and
>comes out of a mis-specification of compile,, as you actually don't have
>access to the compilation semantics of an xt in ANS Forth.
In ANS Forth compilation semantics is bound to named words, not xts.
There are two places where it occurs: When the text interpreter
processes a (named) word in compilation state, and in POSTPONE (which
also takes a name).
I think that COMPILE, is well specified. Why do you think it is
mis-specified? And please post your "improved" specification again.
>The fix for that IMHO is to provide interp, for the purpose you want. That
>word makes pretty clear that you append the interpretation/execution
>semantics, and are not actually attempting to really compile the token.
You mean that we should change "COMPILE," to do something different
from what it does now, and introduce "INTERP," to do what "COMPILE,"
does now? Memories of Forth-83 arise.
An alternative would be to just leave "COMPILE," as it is and
introduce a new word (maybe "COMPSEM,", but you sure can come up with
a better name) that does what you want. You would have to use
"COMPSEM," in the interpreter loop, but the FIND would be cleaner.
Or, if you want to keep the Bradley interpreter loop unchanged,
implement FIND to return different xts depending on STATE (like Gforth
is doing now). You can still introduce "COMPSEM," if you want.
>This is Forth, we are striving for simplicity. One indication about
>simplicity is orthogonality in the description. The ANS Forth standard has
>three clearly defined semantics: interpretation, compilation, and run-time
>semantics. By default, run-time=interpretation, and compilation=add
>interpretation semantics.
Yes, except that what you call "run-time semantics" is called
"execution semantics" in ANS Forth, and in ANS Forth the run-time
semantics of some words is a helper for defining the compilation
semantics of that word.
> Now, COMPILE, is specified to perform the
>default, this is breaking the symmetry, and making things more complicated.
What symmetry?
What makes things complicated is combined words.
>The reason is that at that time, non-default compilation semantics was
>specified by IMMEDIATE, and the xt doesn't know if it's immediate or not.
And? Why should it be necessary to know that?
>Let's assume we do what you suggest: add another method to the vtable, and
>add another word to do "the compiling", which would be something different
>than compile,. Now, you might have set-compiler and set-compile, to set
>them. How to choose which is the appropriate one? Most of the time, it
>doesn't make a difference, so chances are high that people will not
>understand why there are two, and treat them interchangeable. It will
>sometimes result in non-optimal code (if the optimizing version ends up in
>compiler, but should end up in compile,), sometimes in bugs like the above,
>where you can't use COMPILE, to get at the interpretation semantics.
These are not bugs. These use COMPILE, as specified.
OTOH, if you are right, you should be able to point to lots of uses of
COMPILE, where the current usage of COMPILE, is wrong, because the
programmer actually intended to perform the compilation semantics
instead of appending the intepretation/execution semantics. Until now
we only know several cases that would be broken by the change you
suggest for "COMPILE,". How many cases do you have that would be
fixed by that change?
>If you have two things that do almost the same, but differ in sublte things
>that happen only once in a blue moon, you better do just one of them.
Sounds like an argument against your "INTERP," (as well as against
"COMPSEM,").
You can also look at how many uses of POSTPONE, are wrong. Of course
POSTPONE, is sufficiently different (different stack effect) that it's
not easy to use it instead of COMPILE,. If so, and you are right
about confusing "COMPILE," with the other words, that's an argument
against going for a universal xt.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2013: http://www.euroforth.org/ef13/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
State and the standard ... Rob Sciuk <rob@controlq.com> - 2013-02-28 11:35 -0500
Re: State and the standard ... "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2013-03-01 20:46 -0500
Re: State and the standard ... Elizabeth D Rather <erather@forth.com> - 2013-03-01 19:33 -1000
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-02 03:33 -0600
Re: State and the standard ... "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2013-03-03 18:09 -0500
Re: State and the standard ... "Elizabeth D. Rather" <erather@forth.com> - 2013-03-03 15:01 -1000
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-04 03:06 -0600
Re: State and the standard ... Lars Brinkhoff <lars.spam@nocrew.org> - 2013-03-04 11:38 +0100
Re: State and the standard ... stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-02 11:34 +0000
Re: State and the standard ... "A. K." <akk@nospam.org> - 2013-03-02 13:47 +0100
Re: State and the standard ... Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-02 14:07 +0100
Re: State and the standard ... Rob Sciuk <rob@controlq.com> - 2013-03-02 12:38 -0500
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-02 15:50 -0600
Re: State and the standard ... albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-02 22:11 +0000
Re: State and the standard ... Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-03 02:51 +0100
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-03 14:56 +0000
Re: State and the standard ... Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-03 22:42 +0100
Re: State and the standard ... stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-03 22:02 +0000
Re: State and the standard ... Mark Wills <markrobertwills@yahoo.co.uk> - 2013-03-04 00:19 -0800
Re: State and the standard ... Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-05 00:14 +0100
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-08 16:34 +0000
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-07 18:04 +0000
Re: State and the standard ... Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-08 01:31 +0100
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-08 14:41 +0000
Re: State and the standard ... Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-09 17:04 +0100
Re: State and the standard ... Mark Wills <markrobertwills@yahoo.co.uk> - 2013-03-08 02:19 -0800
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-08 04:25 -0600
Re: State and the standard ... Mark Wills <markrobertwills@yahoo.co.uk> - 2013-03-08 03:35 -0800
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-08 06:58 -0600
Re: State and the standard ... Coos Haak <chforth@hccnet.nl> - 2013-03-08 20:57 +0100
Re: State and the standard ... Rob Sciuk <rob@controlq.com> - 2013-03-03 11:25 -0500
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-03 15:13 -0600
Re: State and the standard ... Coos Haak <chforth@hccnet.nl> - 2013-03-04 20:55 +0100
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-04 15:17 -0600
Re: State and the standard ... Coos Haak <chforth@hccnet.nl> - 2013-03-05 00:27 +0100
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-04 18:41 -0600
Re: State and the standard ... "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2013-03-04 20:49 -0500
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-05 02:59 -0600
Re: State and the standard ... Alex McDonald <blog@rivadpm.com> - 2013-03-05 06:58 -0800
Re: State and the standard ... Howerd <howerdo@yahoo.co.uk> - 2013-03-02 14:50 -0800
Re: State and the standard ... Rob Sciuk <rob@controlq.com> - 2013-03-03 11:06 -0500
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-03 14:17 +0000
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-02 17:55 +0000
Re: State and the standard ... Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-02 20:24 +0100
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-03 14:25 +0000
Re: State and the standard ... Lars Brinkhoff <lars.spam@nocrew.org> - 2013-03-03 16:27 +0100
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-03 15:15 -0600
Re: State and the standard ... Howerd <howerdo@yahoo.co.uk> - 2013-03-03 13:41 -0800
Re: State and the standard ... Paul Rubin <no.email@nospam.invalid> - 2013-03-10 00:51 -0800
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-10 04:35 -0500
Re: State and the standard ... Paul Rubin <no.email@nospam.invalid> - 2013-03-10 20:56 -0700
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-11 03:47 -0500
Re: State and the standard ... Paul Rubin <no.email@nospam.invalid> - 2013-03-13 23:48 -0700
Re: State and the standard ... "Elizabeth D. Rather" <erather@forth.com> - 2013-03-13 21:01 -1000
Re: State and the standard ... Paul Rubin <no.email@nospam.invalid> - 2013-03-14 00:23 -0700
Re: State and the standard ... Lars Brinkhoff <lars.spam@nocrew.org> - 2013-03-14 09:18 +0100
Re: State and the standard ... Lars Brinkhoff <lars.spam@nocrew.org> - 2013-11-21 14:26 +0100
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-14 03:34 -0500
Re: State and the standard ... albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-14 11:25 +0000
Re: State and the standard ... Mark Wills <forthfreak@gmail.com> - 2013-03-11 01:51 -0700
Re: State and the standard ... Howerd <howerdo@yahoo.co.uk> - 2013-03-10 03:03 -0700
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-07 18:00 +0000
Re: State and the standard ... Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-03 22:49 +0100
Re: State and the standard ... "A. K." <akk@nospam.org> - 2013-03-05 00:18 +0100
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-04 18:44 -0600
intelligent COMPILE, and smart COMPILE, anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-04 17:52 +0000
Re: intelligent COMPILE, and smart COMPILE, Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-05 00:49 +0100
Re: intelligent COMPILE, and smart COMPILE, stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-05 10:55 +0000
Re: State and the standard ... albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-02 22:22 +0000
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-02 17:37 +0000
Re: State and the standard ... "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2013-03-03 18:08 -0500
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-08 16:26 +0000
Re: State and the standard ... Michael L Gassanenko <m_l_g3@yahoo.com> - 2013-03-04 23:08 -0800
Re: State and the standard ... Rob Sciuk <rob@controlq.com> - 2013-03-05 10:47 -0500
Re: State and the standard ... "Elizabeth D. Rather" <erather@forth.com> - 2013-03-05 08:11 -1000
Re: State and the standard ... Rob Sciuk <rob@controlq.com> - 2013-03-05 13:44 -0500
Re: State and the standard ... "Elizabeth D. Rather" <erather@forth.com> - 2013-03-05 09:26 -1000
Re: State and the standard ... Michael L Gassanenko <m_l_g3@yahoo.com> - 2013-03-07 04:24 -0800
Re: State and the standard ... Doug Hoffman <glidedog@gmail.com> - 2013-03-07 09:42 -0500
Re: State and the standard ... "Elizabeth D. Rather" <erather@forth.com> - 2013-03-07 08:16 -1000
Re: State and the standard ... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-08 17:14 +0000
Re: State and the standard ... "Elizabeth D. Rather" <erather@forth.com> - 2013-03-08 08:57 -1000
Re: State and the standard ... Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-09 17:31 +0100
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-09 12:28 -0600
Re: State and the standard ... Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-09 21:41 +0100
Re: State and the standard ... "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-03-06 17:51 -0500
Re: State and the standard ... "Elizabeth D. Rather" <erather@forth.com> - 2013-03-06 13:13 -1000
Re: State and the standard ... "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-03-06 17:51 -0500
Re: State and the standard ... "Elizabeth D. Rather" <erather@forth.com> - 2013-03-06 13:12 -1000
Re: State and the standard ... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-05 18:18 -0600
Re: State and the standard ... Brad Eckert <hwfwguy@gmail.com> - 2013-03-06 08:22 -0800
Re: State and the standard ... "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-03-06 17:49 -0500
Re: State and the standard ... Rob Sciuk <rob@controlq.com> - 2013-03-06 17:56 -0500
Re: State and the standard ... Rob Sciuk <rob@controlq.com> - 2013-03-06 18:17 -0500
Re: State and the standard ... "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-03-08 04:22 -0500
csiph-web