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


Groups > comp.lang.forth > #44088

Re: Ann: ANS/FORTH 2012 test suite update

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: Ann: ANS/FORTH 2012 test suite update
Date 2015-12-05 15:57 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2015Dec5.165730@mips.complang.tuwien.ac.at> (permalink)
References (6 earlier) <n3g4qm$aej$1@dont-email.me> <n3h53t$s5v$1@dont-email.me> <2015Nov30.190422@mips.complang.tuwien.ac.at> <n3iesv$62i$1@dont-email.me> <n3mfpb$gh3$1@dont-email.me>

Show all headers | View raw


Gerry Jackson <gerry@jackson9000.fsnet.co.uk> writes:
>On 30/11/2015 21:28, Gerry Jackson wrote:
>> On 30/11/2015 18:04, Anton Ertl wrote:
>>> If you NAME>INTERPRET or ' IF, you get the xt for the compilation
>>> semantics of IF, and I think that's also the case for all the other
>>> remaining compile-only words.  Likewise, if you text-interpret IF (in
>>> either state), the text interpreter will perform the compilation
>>> semantics (so they have all become immediate in every sense, not just
>>> "immediate-but-...").  Example:
>>>
>>> : foo [ if ] ." foo" then ;
>>> :1: warning: IF is compile-only ok
>>> 0 foo  ok
>>> 1 foo foo ok
>>> : bar [ ' if execute ] ." bar" then ;
>>> :4: warning: IF is compile-only ok
>>> 0 bar  ok
>>> 1 bar bar ok
>>
>> Why would anyone want to do that when it is easier to write e.g.
>> : foo if ." foo" then ;

I did it to demonstrate what happens.

Other people want to ' IF and expect EXECUTEing that to perform the
compilation semantics of IF, because that's what they are used to from
classical implementations.  Sure, as you point out, one can define

: comp-if postpone if ; \ maybe immediate

and then ' COMP-IF to get the same effect in Forth-94/2012, but why
make them jump through hoops?  There have been several complaints
about Gforth's behaviour on ' IF etc. over the years, and that's one
factor in the decision.

More importantly, the deviation from the conventional
single-xt-with-immediate-flag model in the standard is spawning
abominations like VFX's "COMPILE," (which is not (but it should be)
equivalent to ": compile, postpone literal postpone execute ;") and
after two decades we are diverging rather than converging in that
area, so my thinking is that maybe we should converge on that old
model and replace everything that does not fit it (i.e., what people
try to do with STATE-smart words in that model) with better
alternatives.

>> What happens then if someone types e.g.
>> if           \ or
>> ' if execute
>> Does Gforth just issue a warning and then compile some code that is
>> inaccesible and therefore useless? Also leaving control-flow information
>> on the stack?

Yes and yes.

>So GForth interprets the line, compiling stuff because of the IF ... 
>THEN, but the IF ... THEN are otherwise noops as far as the interpreting 
>is concerned.

Yes.

- 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 2015: http://www.rigwit.co.uk/EuroForth2015/

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


Thread

Ann: ANS/FORTH 2012 test suite update Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-27 20:06 +0000
  Re: Ann: ANS/FORTH 2012 test suite update Aliaksei Chapyzhenka <alex.drom@gmail.com> - 2015-11-27 22:19 -0800
  Re: Ann: ANS/FORTH 2012 test suite update peter.m.falth@gmail.com - 2015-11-28 10:07 -0800
    Re: Ann: ANS/FORTH 2012 test suite update Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-29 10:13 +0000
    Re: Ann: ANS/FORTH 2012 test suite update "steve@srpalmer.me.uk" <steverpalmer27@gmail.com> - 2015-11-29 03:47 -0800
      Re: Ann: ANS/FORTH 2012 test suite update Albert van der Horst <albert@spenarnc.xs4all.nl> - 2015-11-29 12:41 +0000
      Re: Ann: ANS/FORTH 2012 test suite update anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-29 12:41 +0000
      Re: Ann: ANS/FORTH 2012 test suite update peter.m.falth@gmail.com - 2015-11-29 08:41 -0800
        Re: Ann: ANS/FORTH 2012 test suite update peter.m.falth@gmail.com - 2015-11-29 10:47 -0800
          Re: Ann: ANS/FORTH 2012 test suite update Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-29 20:29 +0000
            Re: Ann: ANS/FORTH 2012 test suite update peter.m.falth@gmail.com - 2015-11-29 14:44 -0800
              Re: Ann: ANS/FORTH 2012 test suite update Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-30 01:24 +0100
                Re: Ann: ANS/FORTH 2012 test suite update Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-30 09:35 +0000
                Re: Ann: ANS/FORTH 2012 test suite update anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-30 18:04 +0000
                Re: Ann: ANS/FORTH 2012 test suite update Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-30 21:28 +0000
                Re: Ann: ANS/FORTH 2012 test suite update Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-30 22:59 +0100
                Re: Ann: ANS/FORTH 2012 test suite update Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-12-01 12:29 +0000
                Re: Ann: ANS/FORTH 2012 test suite update Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-12-02 10:08 +0000
                Re: Ann: ANS/FORTH 2012 test suite update anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-05 15:57 +0000
              Re: Ann: ANS/FORTH 2012 test suite update Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-30 09:49 +0000
                Re: Ann: ANS/FORTH 2012 test suite update anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-30 18:16 +0000
                Re: Ann: ANS/FORTH 2012 test suite update Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-30 21:28 +0000
              Re: Ann: ANS/FORTH 2012 test suite update Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-30 10:25 +0000
          Re: Ann: ANS/FORTH 2012 test suite update "Elizabeth D. Rather" <erather@forth.com> - 2015-11-29 13:14 -1000
          Re: Ann: ANS/FORTH 2012 test suite update steverpalmer27@gmail.com - 2015-11-30 03:51 -0800
            Re: Ann: ANS/FORTH 2012 test suite update peter.m.falth@gmail.com - 2015-11-30 09:00 -0800
              Re: Ann: ANS/FORTH 2012 test suite update "Elizabeth D. Rather" <erather@forth.com> - 2015-11-30 07:54 -1000
                Re: Ann: ANS/FORTH 2012 test suite update Albert van der Horst <albert@spenarnc.xs4all.nl> - 2015-11-30 18:25 +0000
                Re: Ann: ANS/FORTH 2012 test suite update "Elizabeth D. Rather" <erather@forth.com> - 2015-11-30 11:06 -1000
      Re: Ann: ANS/FORTH 2012 test suite update "Elizabeth D. Rather" <erather@forth.com> - 2015-11-29 13:08 -1000

csiph-web