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


Groups > comp.lang.forth > #43814

Re: description of Forth-2012's `synonym`

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: description of Forth-2012's `synonym`
Date 2015-11-26 07:56 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2015Nov26.085600@mips.complang.tuwien.ac.at> (permalink)
References (2 earlier) <n326pk$3dd$1@speranza.aioe.org> <n333pi$g34$2@dont-email.me> <3a2d26eb-f11d-43b7-b601-6a005da5c763@googlegroups.com> <2015Nov25.141310@mips.complang.tuwien.ac.at> <n34qtq$urj$1@dont-email.me>

Show all headers | View raw


Gerry Jackson <gerry@jackson9000.fsnet.co.uk> writes:
>On 25/11/2015 13:13, Anton Ertl wrote:
>> In the sense of what FIND returns for IF, a standard system has to
>> return 1 (immediate) for IF, or one cannot implement a user-defined
>> text interpreter with this system.
>
>Does the standard actually state that a standard system has to permit 
>the definition of a user-defined text interpreter.

Not in the normative part.  The informative part makes it clear that
that was the intention, though (e.g., look in the rationale for
COMPILE,).

Anyway, that's why I phrased the sentence in the way above.  Another
way to phrase it is: "If a system wants to be standard and wants the
classical user-defined text interpreter to work, it has to return 1
(immediate) for IF."

>FIND IF returning 1 seems to contradict the specification for IF that 
>does not state that IF is immediate so that a system with an immediate 
>IF is non-standard.

The standard does not specify immediacy or non-immediacy for most
words, with the idea that this is an implementation decision.

The idea was to allow cmForth, where all primitives (e.g., +) return 1
and the xt of a word that generates the code for an addition in
compile state.

The other direction, returning -1 for traditionally immediate word is
implemented in VFX, but for words like IF where the compilation
semantics have a stack effect other than ( -- ), results in COMPILE,
having a non-standard stack effect.

>Incidentally the specification for FIND permits it to return different 
>values when compiling or interpreting. But SEARCH-WORDLIST doesn't. That 
>seems inconsistent.

Yes.  Apparently FIND was intended to be used in user-defined text
interpreters, but SEARCH-WORDLIST was not.  Gforth implements that
difference, and it rarely led to complaints (one complaint from Bernd
Paysan this year, the previous one from Jonah Thomas in 2007).  For a
longer discussion of the difference, read
<2015Jul4.155835@mips.complang.tuwien.ac.at>.

I think the solution is to have FIND-NAME ( c-addr u -- nt | 0 ) and
something like Gforth's (SEARCH-WORDLIST) ( c-addr u wid -- nt | 0 )
(but with a better name).

- 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

description of Forth-2012's `synonym` Marcos Cruz <use_the_contact_page@programandala.net> - 2015-11-23 20:47 +0000
  Re: description of Forth-2012's `synonym` Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-23 22:55 +0100
    Re: description of Forth-2012's `synonym` Marcos Cruz <use_the_contact_page@programandala.net> - 2015-11-23 22:20 +0000
      Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-24 05:12 +0000
    Re: description of Forth-2012's `synonym` Marcos Cruz <use_the_contact_page@programandala.net> - 2015-11-24 17:29 +0000
      Re: description of Forth-2012's `synonym` Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-25 02:46 +0100
        Re: description of Forth-2012's `synonym` Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-24 22:46 -0800
          Re: description of Forth-2012's `synonym` Mark Wills <markwills1970@gmail.com> - 2015-11-25 01:39 -0800
            Re: description of Forth-2012's `synonym` Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 02:37 -0800
          Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-25 13:13 +0000
            Re: description of Forth-2012's `synonym` Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 09:06 -0800
              Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-25 18:33 +0000
                Re: description of Forth-2012's `synonym` Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 23:01 -0800
                Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-26 07:15 +0000
                Re: description of Forth-2012's `synonym` Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-26 02:30 -0800
                Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-26 13:44 +0000
            Re: description of Forth-2012's `synonym` Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-25 17:27 +0000
              Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-26 07:56 +0000
                Re: description of Forth-2012's `synonym` Albert van der Horst <albert@spenarnc.xs4all.nl> - 2015-11-26 11:25 +0000
                Re: description of Forth-2012's `synonym` Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-27 01:36 +0100
                Re: description of Forth-2012's `synonym` Albert van der Horst <albert@spenarnc.xs4all.nl> - 2015-11-27 16:57 +0000
                Re: description of Forth-2012's `synonym` Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-27 19:18 +0000
                Re: description of Forth-2012's `synonym` Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-27 19:22 +0000
                Re: description of Forth-2012's `synonym` Mark Wills <markwills1970@gmail.com> - 2015-11-27 11:48 -0800
                Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-28 11:07 +0000
                Re: description of Forth-2012's `synonym` Matthias Trute <matthias.trute@gmail.com> - 2015-11-28 12:34 -0800
      Re: description of Forth-2012's `synonym` hughaguilar96@gmail.com - 2015-11-26 18:43 -0800
        Re: description of Forth-2012's `synonym` Marcos Cruz <use_the_contact_page@programandala.net> - 2015-12-05 03:35 +0000
    Re: description of Forth-2012's `synonym` hughaguilar96@gmail.com - 2015-11-26 14:39 -0800

csiph-web