Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #43760

Re: POSTPONE behaviour

From rickman <gnuarm@gmail.com>
Newsgroups comp.lang.forth
Subject Re: POSTPONE behaviour
Date 2015-11-25 10:54 -0500
Organization A noiseless patient Spider
Message-ID <n34led$7p6$1@dont-email.me> (permalink)
References (3 earlier) <98a20b8e-3531-4d97-9fbb-f16216edca0d@googlegroups.com> <86vb8qv9be.fsf@vps34351.public.cloudvps.com> <b18ae92a-815d-4c01-a570-052215b96346@googlegroups.com> <n33pnt$2tq$1@dont-email.me> <2015Nov25.144519@mips.complang.tuwien.ac.at>

Show all headers | View raw


On 11/25/2015 8:45 AM, Anton Ertl wrote:
> rickman <gnuarm@gmail.com> writes:
>> On 11/25/2015 2:38 AM, Raimond Dragomir wrote:
>>> miercuri, 25 noiembrie 2015, 09:15:35 UTC+2, Lars Brinkhoff a scris:
>>>> Raimond Dragomir <raimond.dragomir@gmail.com> writes:
>>>>>> 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.
>>>>
>>>> No, in an ANS Forth, GT4 should not call GT1.
>>>
>>> And do what else?
>>> GT4 has GT1 compiled in it. When GT4 is executed, it executes GT1.
>>> When GT4 is executed (not compiled). And this happens when GT5 is defined
>>> because GT4 is immediate.
>>
>> This wasn't clear to me until I read these sections of the standard...
>> well, the 2012 standard.  Is any of this different from the 94 standard
>> that seems to be the one under discussion?
>
> The 2012 standard is the same in these areas, but what Raimond
> Dragomir writes here is wrong.
>
>> 6.1.2033 POSTPONE CORE
>> Interpretation: Interpretation semantics for this word are undefined.
>> Compilation: ( “(spaces)name” -- )
>> Skip leading space delimiters. Parse name delimited by a space. Find
>> name. Append the compilation semantics of name to the current
>> definition. An ambiguous condition exists if name is not found.
>>
>> 3.4.3.3 Compilation semantics
>> Unless otherwise specified in a “ Compilation: ” section of the glossary
>> entry, the compilation semantics of a Forth definition shall be to
>> append its execution semantics to the execution semantics of the current
>> definition.
>>
>> So postponing a word that is not immediate does nothing special, right?
>>   In essence, for a non-immediate word POSTPONE is a noop.
>
> Wrong.
>
> GT1 is a word with default compilation semantics (i.e., you get them
> from Section 3.4.3.3 cited above.  POSTPONE GT1 appends the
> *compilation* semantics of GT1 to GT4, whereas just writing GT1 would
> append the *execution* semantics of GT1 to GT4.  Or, in other words,
> POSTPONE GT1 appends the appending of the execution semantics of GT1
> to GT4.  When GT4 is performed in the next line, it appends the
> execution semantics of GT1 to GT5.  And when GT5 is performed in the
> next line, it performs the execution semantics of GT1 and pushes 123
> on the stack.

Yes, on rereading the standard along with the various comments I get 
that now.  Thanks.  The whole thing is a bit trippy really.

If GT1 is postponed into a non-immediate work the compilation of GT1 is 
delayed until one of these words is actually executed.  One of those 
mind expanding things about Forth.  I think I've seen this and not fully 
understood it before.  I need to hang out here more often.  lol

-- 

Rick

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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