Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #13443
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: How to use the "compile," word |
| Date | 2012-07-02 17:03 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2012Jul2.190352@mips.complang.tuwien.ac.at> (permalink) |
| References | <fb4d99b3-a0ad-4417-b703-d9809a662b1e@googlegroups.com> <7f1f48a4-8c78-43e1-8c5f-92b185382564@f16g2000yqg.googlegroups.com> <jsq2lo$s0m$1@online.de> <c576a3b2-b02a-4190-a4ef-90744d22fefe@t8g2000yqd.googlegroups.com> <jsqlru$rpp$1@online.de> |
Bernd Paysan <bernd.paysan@gmx.de> writes:
>BruceMcF wrote:
>
>> On Jul 1, 1:50 pm, Bernd Paysan <bernd.pay...@gmx.de> wrote:
>>>In VFX Forth, you get the compilation semantics by
>>> doing so, ...
>>
>> Wait a minute ~ what is the point of having a supposed "smart"
>> compiler if it gives the wrong result when ['] ticks the
>> interpretation semantics of S"
>
>You get the interpretation semantics of S" with ['] S" EXECUTE. You get
>the compilation semantics with ['] S" COMPILE,. Just like with any
>other non-immediate word (S" is not immediate in VFX, same with IF, TO,
>and many other words).
That's a bug. VFX's COMPILE, does the right thing for words with
default compilation semantics and for immediate words (for immediate
words VFX's COMPILE, does not give you the compilation semantics, and
there it behaves as specified by COMPILE,).
>If we follow the ANS Forth standard literally, like Anton does, we have
>to come to the conclusion that the only standard-compliant system is the
>one where FIND returns two different tokes depending on STATE. 1994,
>this was existing (cmForth), but not very common.
That's certainly a possibility indicated in the description of FIND.
So you would ruin "COMPILE,", which has a very clear specification,
which has also been reconfirmed by the "deities" you would like to use
to override the specification, in order to avoid an implementation
option in FIND which was explicitly allowed in the description of
FIND?
>The point of a "smart" COMPILE, is to have one xt for both
>interpretation and compilation state, and use EXECUTE and COMPILE, to
>access the two semantics. IMHO what we should specify is:
>
>' foo execute is equivalent to foo in interpretation state
>' foo compile, is equivalent to foo in compilation state if foo is
>non-immediate, while
>' foo execute is equivalent to foo in compilation state if it is
>immediate
Only over my dead body. If you want a word that does something other
than "COMPILE,", call it differently. You should have learned the
lesson with Forth-83 (which changed NOT, among others). And even with
a different name, I don't see the point of such a word.
While I was looking for an example of COMPILE, usage, I came across
this piece of code from Gray:
: generate-nt \ -- )
exec dup @ if
@ compile,
else
postpone literal
postpone @
postpone execute
endif ;
Here the fact that EXECUTE and COMPILE, eventually lead to performing
the same emantics is directly used: If we already know which xt will
eventually be performed, we COMPILE, it, otherwise we compile the
address of the place where the xt will be stored, a "@" an an EXECUTE.
This works only correctly if COMPILE, compiles the same semantics that
EXECUTE performs.
BTW, while "smart COMPILE," may give the right association with
"STATE-smart", it might also be confused with "intelligent COMPILE,",
which is a completely different concept.
- 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 2012: http://www.euroforth.org/ef12/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to use the "compile," word teammember0x01@gmail.com - 2012-06-30 16:21 -0700
Re: How to use the "compile," word BruceMcF <agila61@netscape.net> - 2012-06-30 16:53 -0700
Re: How to use the "compile," word Coos Haak <chforth@hccnet.nl> - 2012-07-01 02:06 +0200
Re: How to use the "compile," word BruceMcF <agila61@netscape.net> - 2012-06-30 19:11 -0700
Re: How to use the "compile," word Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-01 19:50 +0200
Re: How to use the "compile," word "Elizabeth D. Rather" <erather@forth.com> - 2012-07-01 08:40 -1000
Re: How to use the "compile," word Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-01 23:14 +0200
Re: How to use the "compile," word BruceMcF <agila61@netscape.net> - 2012-07-01 15:38 -0700
Re: How to use the "compile," word Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-02 01:18 +0200
Re: How to use the "compile," word anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-02 17:03 +0000
Re: How to use the "compile," word Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-02 21:39 +0200
Re: How to use the "compile," word anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-03 16:55 +0000
Re: How to use the "compile," word Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-03 23:09 +0200
Re: How to use the "compile," word BruceMcF <agila61@netscape.net> - 2012-07-02 12:00 -0700
Re: How to use the "compile," word Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-02 22:44 +0200
Re: How to use the "compile," word Josh Grams <josh@qualdan.com> - 2012-07-02 20:18 +0000
Re: How to use the "compile," word Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-02 22:53 +0200
Re: How to use the "compile," word anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-02 16:54 +0000
Re: How to use the "compile," word Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-02 13:05 -0500
Re: How to use the "compile," word anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-03 16:08 +0000
Re: How to use the "compile," word Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-03 14:35 -0500
Re: How to use the "compile," word Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-02 21:03 +0200
Re: How to use the "compile," word anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-03 16:09 +0000
Re: How to use the "compile," word Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-03 22:42 +0200
Re: How to use the "compile," word "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-07-01 04:39 -0400
Re: How to use the "compile," word Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-07-01 04:03 -0500
Re: How to use the "compile," word Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-01 11:48 +0000
Re: How to use the "compile," word Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-07-02 20:46 -0700
csiph-web