Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #43739
| From | Gerry Jackson <gerry@jackson9000.fsnet.co.uk> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: POSTPONE behaviour |
| Date | 2015-11-25 08:03 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <n33pra$3bn$1@dont-email.me> (permalink) |
| References | (1 earlier) <b4792de6-8408-4e0c-8d9d-ddc9558500ef@googlegroups.com> <7f06c60a-bc63-4aa3-adfc-877972fa9120@googlegroups.com> <98a20b8e-3531-4d97-9fbb-f16216edca0d@googlegroups.com> <n33ofa$u7g$1@dont-email.me> <afdb9bd1-acb0-4b66-b63a-ae766e121665@googlegroups.com> |
On 25/11/2015 07:48, Aliaksei Chapyzhenka wrote:
> Looks like not much to read, (2 lines) ;)
The important bit is:
"... Append the compilation semantics of name to the current
definition. ..."
It doesn't distinguish between immediate and non-immediate words.
So if you have
: foo postpone drop ; immediate
: bar foo ;
When BAR is being compiled FOO is executed because it is immediate and
it compiles DROP into BAR because BAR is the "current definition".
>
> https://cloud.githubusercontent.com/assets/511872/11388254/092617c4-92e9-11e5-9bfb-9e0c5433f12a.png
>
> On Tuesday, November 24, 2015 at 11:39:37 PM UTC-8, Gerry wrote:
>> On 25/11/2015 06:54, Raimond Dragomir wrote:
>>>> But failing in this case:
>>>> T{ : GT1 123 ; -> }T
>>>> T{ : GT4 POSTPONE GT1 ; IMMEDIATE -> }T
>>>> T{ : GT5 GT4 ; -> }T
>>>> T{ GT5 -> 123 }T
>>>
>>> Well, think about it: GT4 is immediate. It is executed directly when you
>>> define GT5. When executed it will call GT1 which leaves 123 on the data stack.
>>>
>>> So you already have 123 on the stack after GT5 definition.
>>> Also, GT5 body is just a nop, because you compiled nothing (GT4 just
>>> executed at compile time).
>>> So when you lastly execute GT5 it will leave nothing (but you expect 123)
>>>
>>> Hope it helps
>>>
>> No, you're wrong. If you try it in GForth
>>
>> : GT1 123 ; ok
>> : GT4 POSTPONE GT1 ; IMMEDIATE ok
>> : GT5 GT4 ; ok
>> gt5 . 123 ok
>> see gt5
>> : GT5
>> GT1 ; ok
>>
>> GT4 compiles GT1 into the definition of GT5
>>
>> From your other post:
>>
>> > If the word postponed is not immediate, then postpone is redundant.
>> > .... FOO ... and
>> > .... POSTPONE FOO ... is the same thing if the FOO is not immediate.
>>
>> is wrong too, POSTPONE is used for macros e.g.
>>
>> : RDROP POSTPONE R> POSTPONE DROP ;
>> : FOO RDROP ; ok
>> see RDROP
>> : RDROP [']
>> r> >comp ['] drop >comp ; immediate ok
>> see FOO
>> : FOO
>> r> drop ; ok
>>
>> Read the ANS spec for POSTPONE carefully
>>
>> --
>> Gerry
--
Gerry
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
POSTPONE behaviour Aliaksei Chapyzhenka <alex.drom@gmail.com> - 2015-11-24 21:18 -0800
Re: POSTPONE behaviour Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-24 22:00 -0800
Re: POSTPONE behaviour Aliaksei Chapyzhenka <alex.drom@gmail.com> - 2015-11-24 22:15 -0800
Re: POSTPONE behaviour Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-24 22:54 -0800
Re: POSTPONE behaviour Aliaksei Chapyzhenka <alex.drom@gmail.com> - 2015-11-24 23:09 -0800
Re: POSTPONE behaviour Lars Brinkhoff <lars.spam@nocrew.org> - 2015-11-25 08:15 +0100
Re: POSTPONE behaviour Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-24 23:38 -0800
Re: POSTPONE behaviour Lars Brinkhoff <lars.spam@nocrew.org> - 2015-11-25 08:46 +0100
Re: POSTPONE behaviour Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 00:04 -0800
Re: POSTPONE behaviour rickman <gnuarm@gmail.com> - 2015-11-25 03:01 -0500
Re: POSTPONE behaviour Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 00:09 -0800
Re: POSTPONE behaviour rickman <gnuarm@gmail.com> - 2015-11-25 03:23 -0500
Re: POSTPONE behaviour Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 01:09 -0800
Re: POSTPONE behaviour rickman <gnuarm@gmail.com> - 2015-11-25 10:49 -0500
Re: POSTPONE behaviour "Elizabeth D. Rather" <erather@forth.com> - 2015-11-25 09:10 -1000
Re: POSTPONE behaviour Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-25 09:18 +0000
Re: POSTPONE behaviour Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 02:21 -0800
Re: POSTPONE behaviour Mark Wills <markwills1970@gmail.com> - 2015-11-25 02:47 -0800
Re: POSTPONE behaviour Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-25 13:58 +0000
Re: POSTPONE behaviour Mark Wills <markwills1970@gmail.com> - 2015-11-25 06:35 -0800
Re: POSTPONE behaviour Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-25 18:45 +0100
Re: POSTPONE behaviour Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 22:11 -0800
Re: POSTPONE behaviour Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-26 07:42 +0000
Re: POSTPONE behaviour "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-11-26 05:20 -0500
Re: POSTPONE behaviour anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-26 16:50 +0000
Re: POSTPONE behaviour Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-26 17:59 +0000
Re: POSTPONE behaviour Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-27 19:07 +0100
Re: POSTPONE behaviour anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-28 11:24 +0000
Re: POSTPONE behaviour hughaguilar96@gmail.com - 2015-11-26 12:29 -0800
Re: POSTPONE behaviour Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-27 09:53 +0000
Re: POSTPONE behaviour hughaguilar96@gmail.com - 2015-11-29 21:48 -0800
Re: POSTPONE behaviour Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-30 12:18 +0000
Re: POSTPONE behaviour Lars Brinkhoff <lars.spam@nocrew.org> - 2015-11-30 13:41 +0100
Re: POSTPONE behaviour hughaguilar96@gmail.com - 2015-11-30 19:56 -0800
Re: POSTPONE behaviour Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-12-01 09:59 +0000
Re: POSTPONE behaviour hughaguilar96@gmail.com - 2015-12-01 22:46 -0800
Re: POSTPONE behaviour Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-12-02 07:50 +0000
Re: POSTPONE behaviour anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-25 13:45 +0000
Re: POSTPONE behaviour rickman <gnuarm@gmail.com> - 2015-11-25 10:54 -0500
Re: POSTPONE behaviour Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-25 07:39 +0000
Re: POSTPONE behaviour Aliaksei Chapyzhenka <alex.drom@gmail.com> - 2015-11-24 23:48 -0800
Re: POSTPONE behaviour Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-25 08:03 +0000
Re: POSTPONE behaviour Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-25 18:37 +0100
Re: POSTPONE behaviour "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-11-25 01:27 -0500
Re: POSTPONE behaviour Aliaksei Chapyzhenka <alex.drom@gmail.com> - 2015-11-24 22:51 -0800
Re: POSTPONE behaviour Aliaksei Chapyzhenka <alex.drom@gmail.com> - 2015-11-25 21:19 -0800
csiph-web