Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"I'm a mean green mother from outer space" -- Audrey II, The Little Shop of Horrors


devel / comp.lang.forth / Re: Performing compilation semantics, rethinking (was: RFI Q99-027)

SubjectAuthor
* POSTPONEing literals?dxforth
`* Re: POSTPONEing literals?Hugh Aguilar
 +* Re: POSTPONEing literals?dxforth
 |+* Re: POSTPONEing literals?Anton Ertl
 ||`* Re: POSTPONEing literals?dxforth
 || `* Re: POSTPONEing literals?Anton Ertl
 ||  `* Re: POSTPONEing literals?dxforth
 ||   +- Re: POSTPONEing literals?dxforth
 ||   +* Re: POSTPONEing literals?Ruvim
 ||   |`* Re: POSTPONEing literals?dxforth
 ||   | `- Re: POSTPONEing literals?Ruvim
 ||   `- Re: POSTPONEing literals?Anton Ertl
 |`* Re: POSTPONEing literals?dxforth
 | `* Re: POSTPONEing literals?dxforth
 |  `* Re: POSTPONEing literals?Anton Ertl
 |   +* Re: POSTPONEing literals?dxforth
 |   |`* Re: POSTPONEing literals?Anton Ertl
 |   | +* Re: POSTPONEing literals?Ruvim
 |   | |`* Re: POSTPONEing literals?dxforth
 |   | | `* Re: POSTPONEing literals?Ruvim
 |   | |  +* Re: POSTPONEing literals?none
 |   | |  |`* Re: POSTPONEing literals?Ruvim
 |   | |  | `* Re: POSTPONEing literals?none
 |   | |  |  `* Re: POSTPONEing literals?Ruvim
 |   | |  |   `- Re: POSTPONEing literals?none
 |   | |  `* Re: POSTPONEing literals?dxforth
 |   | |   `* Re: POSTPONEing literals?Ruvim
 |   | |    `* Re: POSTPONEing literals?dxforth
 |   | |     +* Re: POSTPONEing literals?Ruvim
 |   | |     |+* Re: POSTPONEing literals?Hugh Aguilar
 |   | |     ||`- Re: POSTPONEing literals?dxforth
 |   | |     |`* Re: POSTPONEing literals?dxforth
 |   | |     | +* Re: POSTPONEing literals?Ruvim
 |   | |     | |+- VFX bug in COMPILE, (was: POSTPONEing literals?)Ruvim
 |   | |     | |+* Re: POSTPONEing literals?Stephen Pelc
 |   | |     | ||+* Re: POSTPONEing literals?Anton Ertl
 |   | |     | |||`* Re: POSTPONEing literals?Stephen Pelc
 |   | |     | ||| +* Re: POSTPONEing literals?Ruvim
 |   | |     | ||| |`* Re: POSTPONEing literals?Stephen Pelc
 |   | |     | ||| | `* Fix VFX FIND (was: POSTPONEing literals?)Ruvim
 |   | |     | ||| |  +- Re: Fix VFX FIND (was: POSTPONEing literals?)Ruvim
 |   | |     | ||| |  `* Re: Fix VFX FIND (was: POSTPONEing literals?)Stephen Pelc
 |   | |     | ||| |   +* Re: Fix VFX FINDRuvim
 |   | |     | ||| |   |`* Re: Fix VFX FINDStephen Pelc
 |   | |     | ||| |   | `- Re: Fix VFX FINDRuvim
 |   | |     | ||| |   +* Re: Fix VFX FIND (was: POSTPONEing literals?)Paul Liles
 |   | |     | ||| |   |+* Re: Fix VFX FIND (was: POSTPONEing literals?)Ruvim
 |   | |     | ||| |   ||`* Re: Fix VFX FIND (was: POSTPONEing literals?)Paul Liles
 |   | |     | ||| |   || +* Re: Fix VFX FIND (was: POSTPONEing literals?)Anton Ertl
 |   | |     | ||| |   || |`* Re: Fix VFX FIND (was: POSTPONEing literals?)minf...@arcor.de
 |   | |     | ||| |   || | +- Re: Fix VFX FIND (was: POSTPONEing literals?)Paul Liles
 |   | |     | ||| |   || | +* Re: Fix VFX FIND (was: POSTPONEing literals?)Krishna Myneni
 |   | |     | ||| |   || | |`* Re: Fix VFX FIND (was: POSTPONEing literals?)minf...@arcor.de
 |   | |     | ||| |   || | | `* Re: Fix VFX FIND (was: POSTPONEing literals?)Anton Ertl
 |   | |     | ||| |   || | |  +- Re: Fix VFX FIND (was: POSTPONEing literals?)minf...@arcor.de
 |   | |     | ||| |   || | |  +- Re: Fix VFX FIND (was: POSTPONEing literals?)minf...@arcor.de
 |   | |     | ||| |   || | |  +- Re: Fix VFX FIND (was: POSTPONEing literals?)dxforth
 |   | |     | ||| |   || | |  `* single-xt and dual-xt approaches (was: Fix VFX FIND)Ruvim
 |   | |     | ||| |   || | |   +- Re: single-xt and dual-xt approaches (was: Fix VFX FIND)none
 |   | |     | ||| |   || | |   `- Re: single-xt and dual-xt approaches (was: Fix VFX FIND)dxforth
 |   | |     | ||| |   || | `- Re: Fix VFX FIND (was: POSTPONEing literals?)dxforth
 |   | |     | ||| |   || `- Re: Fix VFX FIND (was: POSTPONEing literals?)Ruvim
 |   | |     | ||| |   |`* Re: Fix VFX FIND (was: POSTPONEing literals?)Stephen Pelc
 |   | |     | ||| |   | `* Re: Fix VFX FIND (was: POSTPONEing literals?)Paul Liles
 |   | |     | ||| |   |  +- Re: Fix VFX FIND (was: POSTPONEing literals?)Stephen Pelc
 |   | |     | ||| |   |  `- Re: Fix VFX FIND (was: POSTPONEing literals?)Anton Ertl
 |   | |     | ||| |   `- Re: Fix VFX FIND (was: POSTPONEing literals?)none
 |   | |     | ||| `* Re: POSTPONEing literals?Anton Ertl
 |   | |     | |||  +* Re: POSTPONEing literals?Ruvim
 |   | |     | |||  |+- FIND clarification rationale (was: POSTPONEing literals?)Ruvim
 |   | |     | |||  |+- Re: POSTPONEing literals?Anton Ertl
 |   | |     | |||  |`* Re: POSTPONEing literals?Stephen Pelc
 |   | |     | |||  | +- Re: POSTPONEing literals?Ruvim
 |   | |     | |||  | `* Re: POSTPONEing literals?dxforth
 |   | |     | |||  |  +- Re: POSTPONEing literals?none
 |   | |     | |||  |  +* Re: POSTPONEing literals?Ruvim
 |   | |     | |||  |  |+* Re: POSTPONEing literals?none
 |   | |     | |||  |  ||`- Re: POSTPONEing literals?Ruvim
 |   | |     | |||  |  |`* Re: POSTPONEing literals?dxforth
 |   | |     | |||  |  | +* Re: POSTPONEing literals?Stephen Pelc
 |   | |     | |||  |  | |`- Re: POSTPONEing literals?dxforth
 |   | |     | |||  |  | `- Re: POSTPONEing literals?Ruvim
 |   | |     | |||  |  `- Re: POSTPONEing literals?Doug Hoffman
 |   | |     | |||  `* Re: POSTPONEing literals?Marcel Hendrix
 |   | |     | |||   +- Re: POSTPONEing literals?Ruvim
 |   | |     | |||   `- Re: POSTPONEing literals?Anton Ertl
 |   | |     | ||`- Re: POSTPONEing literals?Ruvim
 |   | |     | |`* Re: POSTPONEing literals?dxforth
 |   | |     | | `* Re: POSTPONEing literals?Anton Ertl
 |   | |     | |  `* Re: POSTPONEing literals?dxforth
 |   | |     | |   `* Re: POSTPONEing literals?Ruvim
 |   | |     | |    `* Re: POSTPONEing literals?dxforth
 |   | |     | |     `* Re: POSTPONEing literals?P Falth
 |   | |     | |      `* Re: POSTPONEing literals?Ruvim
 |   | |     | |       +* Alternative to FIND (was: POSTPONEing literals?)Ruvim
 |   | |     | |       |`* Re: Alternative to FIND (was: POSTPONEing literals?)P Falth
 |   | |     | |       | +* Re: Alternative to FIND (was: POSTPONEing literals?)Anton Ertl
 |   | |     | |       | |`- Re: Alternative to FIND (was: POSTPONEing literals?)P Falth
 |   | |     | |       | `* Re: Alternative to FINDRuvim
 |   | |     | |       |  `* Re: Alternative to FINDP Falth
 |   | |     | |       |   +- Re: Alternative to FINDminf...@arcor.de
 |   | |     | |       |   +* Re: Alternative to FINDRuvim
 |   | |     | |       |   `* Re: Alternative to FINDStephen Pelc
 |   | |     | |       `* Re: POSTPONEing literals?P Falth
 |   | |     | `- Re: POSTPONEing literals?Stephen Pelc
 |   | |     `* Re: POSTPONEing literals?Anton Ertl
 |   | `- Re: POSTPONEing literals?dxforth
 |   `- Re: POSTPONEing literals?none
 `* Re: POSTPONEing literals?azathot...@gmail.com

Pages:123456789
R-related words definition (was: Odd cases of undefined interpretation semantics)

<s9ffms$spn$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13387&group=comp.lang.forth#13387

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: R-related words definition (was: Odd cases of undefined
interpretation semantics)
Date: Sat, 5 Jun 2021 12:21:30 +0300
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <s9ffms$spn$1@dont-email.me>
References: <s6a8o8$va3$1@gioia.aioe.org> <s8fok1$9tj$1@gioia.aioe.org>
<1p9ojmn.1ltc322xcydw9N%awegel@arcor.de> <s8hk3s$1472$1@gioia.aioe.org>
<60acbca4.512609@news.eternal-september.org> <s8k76l$1j8l$1@gioia.aioe.org>
<60b09b34.1667671@news.eternal-september.org> <s8qk23$7vn$1@dont-email.me>
<s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me>
<2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me>
<2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me>
<2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 5 Jun 2021 09:21:32 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="90e5d4ff00c7d20d8416d007f95fceb1";
logging-data="29495"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/C1CO6oHEd3czsySfrbob8"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:Xvs/qXIiiv+cczpafIgf1dLbGGo=
In-Reply-To: <s9cjts$jae$1@dont-email.me>
Content-Language: en-US
 by: Ruvim - Sat, 5 Jun 2021 09:21 UTC

On 2021-06-04 10:15, Ruvim wrote:
> On 2021-05-30 19:59, Anton Ertl wrote:
>> Ruvim <ruvim.pinka@gmail.com> writes:
>>> On 2021-05-29 20:36, Anton Ertl wrote:
[...]
>>>> Of course, the other problem is that some Forth systems implement
>>>> EXECUTE in a way that puts stuff on the return stack around the
>>>> execution, so these systems work like your E.  Given that nobody
>>>> complains about that, maybe EXECUTE's definition should be refined
>>>> appropriately, "solving" all the problems with "can I EXECUTE the xt of
>>>> <return-stack-accessing-word>".
>>>
>>> I think, this problem was solved via disallowance of obtaining the xt of
>>> <return-stack-accessing-word> (since such words have undefined
>>> interpretation semantics).
>>
>> Yes, but I think we should put this possible effect of EXECUTE in
>> EXECUTE,
>
> It's not easy, since the behavior of "EXECUTE" should be broken up into
> three phases for that.
>
> Another question is, should this possible effect be also put in "CATCH",
> "EVALUATE", "INCLUDED"?
>
>
>
>> and also put a related limitation on the text interpreter,
>
> That it shouldn't use the return stack? Or what the limitation?
>
>
>
>> and delete the undefinition of the interpretation semantics of >R etc.
>>
>> This would make
>>
>> : foo [ ' >r compile, ] r> ;
>>
>> standard.
>
> I dislike this latter idea, since it makes nonstandard the existing
> dual-semantics implementations for R-words.

One more problem with this approach is an inconsistency concerning
redefinitions.

An R-related word can be redefined only as an immediate word.
E.g.:

: exit ( some stuff ) postpone exit ; immediate
: >r ( some stuff ) postpone >r ; immediate

And after such a redefinition, the phrase
['] >r compile,
or
[ ' >r compile, ]

produces the different effects than before the redefinition.

It's the same problem as about "[compile]", when the phrase
[compile] exit

produces the different effects after a redefinition of "exit", than
before the redefinition.

The capability to redefine words is very important in Forth, I believe.

If we want to keep this capability, the standard should not allow to
obtain the execution token for R-related words (regardless of the
definition for interpretation semantics for them), since that produces
an intrinsic inconsistency.

--
Ruvim

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<2021Jun5.135558@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13392&group=comp.lang.forth#13392

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: R-related words definition (was: Odd cases of undefined interpretation semantics)
Date: Sat, 05 Jun 2021 11:55:58 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 129
Message-ID: <2021Jun5.135558@mips.complang.tuwien.ac.at>
References: <s6a8o8$va3$1@gioia.aioe.org> <60acbca4.512609@news.eternal-september.org> <s8k76l$1j8l$1@gioia.aioe.org> <60b09b34.1667671@news.eternal-september.org> <s8qk23$7vn$1@dont-email.me> <s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me> <2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me> <2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me> <2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me> <s9ffms$spn$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="16704da12b085874bfd9bd0391e8f4bb";
logging-data="16369"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KDIT7PhcfgtQogbCpo383"
Cancel-Lock: sha1:XEsh3uGNxUZlWEhm/5QW786TFnA=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 5 Jun 2021 11:55 UTC

Ruvim <ruvim.pinka@gmail.com> writes:
>On 2021-06-04 10:15, Ruvim wrote:
>> On 2021-05-30 19:59, Anton Ertl wrote:
>>> Ruvim <ruvim.pinka@gmail.com> writes:
>>>> On 2021-05-29 20:36, Anton Ertl wrote:
>[...]
>>>>> Of course, the other problem is that some Forth systems implement
>>>>> EXECUTE in a way that puts stuff on the return stack around the
>>>>> execution, so these systems work like your E.  Given that nobody
>>>>> complains about that, maybe EXECUTE's definition should be refined
>>>>> appropriately, "solving" all the problems with "can I EXECUTE the xt of
>>>>> <return-stack-accessing-word>".
>>>>
>>>> I think, this problem was solved via disallowance of obtaining the xt of
>>>> <return-stack-accessing-word> (since such words have undefined
>>>> interpretation semantics).
>>>
>>> Yes, but I think we should put this possible effect of EXECUTE in
>>> EXECUTE,
>>
>> It's not easy, since the behavior of "EXECUTE" should be broken up into
>> three phases for that.

Instead of:

|Remove xt from the stack and perform the semantics identified by
|it. Other stack effects are due to the word EXECUTEd.

we would write:

|Remove xt from the stack and push nest-sys on the return stack.
|Perform the semantics identified by xt. Remove nest-sys from the
|return stack. Other stack effects are due to the word EXECUTEd.

>> Another question is, should this possible effect be also put in "CATCH",

Catch already specifies that it pushes an exception frame on the
exception stack, which may be the return stack. So >R etc. cannot be
CATCHed in a standard program.

>> "EVALUATE", "INCLUDED"?

That follows from the text interpreter restriction.

>>> and also put a related limitation on the text interpreter,
>>
>> That it shouldn't use the return stack? Or what the limitation?

The text interpreter pushes nest-sys before performing the
interpretation semantics and pops it afterwards.

>>> and delete the undefinition of the interpretation semantics of >R etc.
>>>
>>> This would make
>>>
>>> : foo [ ' >r compile, ] r> ;
>>>
>>> standard.
>>
>> I dislike this latter idea, since it makes nonstandard the existing
>> dual-semantics implementations for R-words.

Which implementations exist that would become non-standard?

The following example works on Gforth, iForth*, SwiftForth, and VFX:

: foo [ ' >r compile, ] r> ; 1 foo . \ prints 1

* iForth works if you first define : compile, compile, ;

>One more problem with this approach is an inconsistency concerning
>redefinitions.
>
>An R-related word can be redefined only as an immediate word.
>E.g.:
>
> : exit ( some stuff ) postpone exit ; immediate
> : >r ( some stuff ) postpone >r ; immediate
>
>And after such a redefinition, the phrase
> ['] >r compile,
>or
> [ ' >r compile, ]
>
>produces the different effects than before the redefinition.
>
>
>It's the same problem as about "[compile]", when the phrase
> [compile] exit
>
>produces the different effects after a redefinition of "exit", than
>before the redefinition.
>
>
>The capability to redefine words is very important in Forth, I believe.

We have SYNONYM for that, so in theory we should be able to do

synonym >r1 >r : foo [ ' >r1 compile, ] r> ; 1 foo . \ prints 1

In practice it works on Gforth and VFX 5.11. The version of iForth I
use does not have SYNONYM, and SwiftForth has a broken implementation.

Let's ignore SYNONYM for no: Then the question is whether the
programmers are better off if they cannot COMPILE, the xt of >R at
all, than if they can do it, but cannot define a word with the same
capability?

For the FIND-based user-defined text interpreter there is also the
issue that FIND returns -1 for >R on many systems, and in compile
state that text-interpreter then calls COMPILE, for the xt returned by
FIND.

In any case, if we want to make this clear, >R etc. should become
words with definitions like

compilation: append the run-time semantics below to the current definition.

run-time: ... (what is currently the execution semantics).

I think we should certainly do that for EXIT, but the case wrt. >R
etc. is less clear to me.

- 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 2021: https://euro.theforth.net/2021

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<s9g59j$asv$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13397&group=comp.lang.forth#13397

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: R-related words definition (was: Odd cases of undefined
interpretation semantics)
Date: Sat, 5 Jun 2021 18:29:52 +0300
Organization: A noiseless patient Spider
Lines: 201
Message-ID: <s9g59j$asv$1@dont-email.me>
References: <s6a8o8$va3$1@gioia.aioe.org>
<60acbca4.512609@news.eternal-september.org> <s8k76l$1j8l$1@gioia.aioe.org>
<60b09b34.1667671@news.eternal-september.org> <s8qk23$7vn$1@dont-email.me>
<s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me>
<2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me>
<2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me>
<2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me>
<s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 5 Jun 2021 15:29:55 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="90e5d4ff00c7d20d8416d007f95fceb1";
logging-data="11167"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/mQ9TZM+6neB37WtEB0gYO"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:uM216vkPBegTtHgKplinbzouh+8=
In-Reply-To: <2021Jun5.135558@mips.complang.tuwien.ac.at>
Content-Language: en-US
 by: Ruvim - Sat, 5 Jun 2021 15:29 UTC

On 2021-06-05 14:55, Anton Ertl wrote:
> Ruvim <ruvim.pinka@gmail.com> writes:
>> On 2021-06-04 10:15, Ruvim wrote:
>>> On 2021-05-30 19:59, Anton Ertl wrote:
>>>> Ruvim <ruvim.pinka@gmail.com> writes:
>>>>> On 2021-05-29 20:36, Anton Ertl wrote:
>> [...]
>>>>>> Of course, the other problem is that some Forth systems implement
>>>>>> EXECUTE in a way that puts stuff on the return stack around the
>>>>>> execution, so these systems work like your E.  Given that nobody
>>>>>> complains about that, maybe EXECUTE's definition should be refined
>>>>>> appropriately, "solving" all the problems with "can I EXECUTE the xt of
>>>>>> <return-stack-accessing-word>".
>>>>>
>>>>> I think, this problem was solved via disallowance of obtaining the xt of
>>>>> <return-stack-accessing-word> (since such words have undefined
>>>>> interpretation semantics).
>>>>
>>>> Yes, but I think we should put this possible effect of EXECUTE in
>>>> EXECUTE,
>>>
>>> It's not easy, since the behavior of "EXECUTE" should be broken up into
>>> three phases for that.
>
> Instead of:
>
> |Remove xt from the stack and perform the semantics identified by
> |it. Other stack effects are due to the word EXECUTEd.
>
> we would write:
>
> |Remove xt from the stack and push nest-sys on the return stack.
> |Perform the semantics identified by xt. Remove nest-sys from the
> |return stack. Other stack effects are due to the word EXECUTEd.

Yes, you have added two steps. It simpler than I thought. Agreed.

I just would also make a better wording concerning "EXECUTEd" and self
referencing, as:

| Other stack effects are due to the semantics performed.

>>> Another question is, should this possible effect be also put in "CATCH",
>
> Catch already specifies that it pushes an exception frame on the
> exception stack, which may be the return stack. So >R etc. cannot be
> CATCHed in a standard program.

Yes, agreed.

>>> "EVALUATE", "INCLUDED"?
>
> That follows from the text interpreter restriction.
>
>>>> and also put a related limitation on the text interpreter,
>>>
>>> That it shouldn't use the return stack? Or what the limitation?
>
> The text interpreter pushes nest-sys before performing the
> interpretation semantics and pops it afterwards.

Ah, yes, agreed. But it isn't a limitation on the text interpreter, but
a limitation on a program.

>>>> and delete the undefinition of the interpretation semantics of >R etc.
>>>>
>>>> This would make
>>>>
>>>> : foo [ ' >r compile, ] r> ;
>>>>
>>>> standard.
>>>
>>> I dislike this latter idea, since it makes nonstandard the existing
>>> dual-semantics implementations for R-words.
>
> Which implementations exist that would become non-standard?

Any single-xt (and, as I expect, almost any dual-xt) implementation
where "FIND" returns n value 1 for ">r" in compilation state, is affected.

For example, SP-Forth/4

> The following example works on Gforth, iForth*, SwiftForth, and VFX:
>
> : foo [ ' >r compile, ] r> ; 1 foo . \ prints 1
>
> * iForth works if you first define : compile, compile, ;
>

>> One more problem with this approach is an inconsistency concerning
>> redefinitions.
>>
>> An R-related word can be redefined only as an immediate word.
>> E.g.:
>>
>> : exit ( some stuff ) postpone exit ; immediate
>> : >r ( some stuff ) postpone >r ; immediate
>>
>> And after such a redefinition, the phrase
>> ['] >r compile,
>> or
>> [ ' >r compile, ]
>>
>> produces the different effects than before the redefinition.
>>
>>
>> It's the same problem as about "[compile]", when the phrase
>> [compile] exit
>>
>> produces the different effects after a redefinition of "exit", than
>> before the redefinition.
>>
>>
>> The capability to redefine words is very important in Forth, I believe.
>
> We have SYNONYM for that, so in theory we should be able to do
>
> synonym >r1 >r : foo [ ' >r1 compile, ] r> ; 1 foo . \ prints 1

But you have miss "some stuff", that I mean some additional code, as:

: >r ... postpone >r ... ; immediate

> In practice it works on Gforth and VFX 5.11. The version of iForth I
> use does not have SYNONYM, and SwiftForth has a broken implementation.
>
> Let's ignore SYNONYM for no: Then the question is whether the
> programmers are better off if they cannot COMPILE, the xt of >R at
> all, than if they can do it, but cannot define a word with the same
> capability?

This dilemma is incorrect.

1. At the moment, the programmers cannot obtain xt of ">R", so they also
cannot apply "COMPILE," to it.

2. The programmers don't need to compile the xt of ">R", actually they
need to append the run-time semantics of ">R".

3. In any case, they can append these semantics via "POSTPONE >R"

4. The problem of redefinition is not only in a word with the same
semantics, but it is also in a word with additional (hidden) semantics.
E.g., for logging, checking a stack balance, debugging, etc.

5. Redefinitions that work before that, will be incompatible with the
new code (that may tick ">R").

Thus, the programmers will lost ability for redefinition, and they won't
get anything new in return, just one *additional* way to append run-time
semantics of ">R".

> For the FIND-based user-defined text interpreter there is also the
> issue that FIND returns -1 for >R on many systems, and in compile
> state that text-interpreter then calls COMPILE, for the xt returned by
> FIND.

Why do you think that it's an issue?

It's allowed and compatible at the moment.

In the general case, when "FIND" is applied to the ">R" string, an xt
that it returns in compilation state is not the xt for the ">R" word.
It's the xt of an internal definition that serves to perform the
compilation semantics for the ">R" word.

> In any case, if we want to make this clear, >R etc. should become
> words with definitions like
>
> compilation: append the run-time semantics below to the current definition.
>
> run-time: ... (what is currently the execution semantics).
>
> I think we should certainly do that for EXIT, but the case wrt. >R
> etc. is less clear to me.

On these I agree.

--
Ruvim

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<2f86e7e1-17a0-471f-8279-e626a30d1b82n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13406&group=comp.lang.forth#13406

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:911:: with SMTP id 17mr8911900qkj.436.1622950546019;
Sat, 05 Jun 2021 20:35:46 -0700 (PDT)
X-Received: by 2002:a0c:d809:: with SMTP id h9mr3833255qvj.47.1622950545866;
Sat, 05 Jun 2021 20:35:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sat, 5 Jun 2021 20:35:45 -0700 (PDT)
In-Reply-To: <2021Jun5.135558@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=148.167.132.245; posting-account=OxDKOgoAAADW0cxAqHqpN1zqeCoSsDap
NNTP-Posting-Host: 148.167.132.245
References: <s6a8o8$va3$1@gioia.aioe.org> <60acbca4.512609@news.eternal-september.org>
<s8k76l$1j8l$1@gioia.aioe.org> <60b09b34.1667671@news.eternal-september.org>
<s8qk23$7vn$1@dont-email.me> <s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me>
<2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me>
<2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me>
<2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me>
<s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2f86e7e1-17a0-471f-8279-e626a30d1b82n@googlegroups.com>
Subject: Re: R-related words definition (was: Odd cases of undefined
interpretation semantics)
From: hughagui...@gmail.com (Hugh Aguilar)
Injection-Date: Sun, 06 Jun 2021 03:35:46 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Hugh Aguilar - Sun, 6 Jun 2021 03:35 UTC

On Saturday, June 5, 2021 at 5:31:40 AM UTC-7, Anton Ertl wrote:
> >The capability to redefine words is very important in Forth, I believe.
> We have SYNONYM for that, so in theory we should be able to do
>
> synonym >r1 >r : foo [ ' >r1 compile, ] r> ; 1 foo . \ prints 1
>
> In practice it works on Gforth and VFX 5.11. The version of iForth I
> use does not have SYNONYM, and SwiftForth has a broken implementation.

Given the disambiguifiers, it is easy to write SYNONYM FAST-SYNONYM and ALIAS.
If SYNONYM works in both Gforth and VFX, then you must be using disambiguifiers
internally.

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13407&group=comp.lang.forth#13407

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:6c4:: with SMTP id 187mr12876028qkg.95.1622985460444; Sun, 06 Jun 2021 06:17:40 -0700 (PDT)
X-Received: by 2002:ac8:ece:: with SMTP id w14mr12698212qti.5.1622985460306; Sun, 06 Jun 2021 06:17:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 6 Jun 2021 06:17:40 -0700 (PDT)
In-Reply-To: <2021Jun5.135558@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ed:a70f:2f01:6087:5f8a:f624:e2f4; posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:ed:a70f:2f01:6087:5f8a:f624:e2f4
References: <s6a8o8$va3$1@gioia.aioe.org> <60acbca4.512609@news.eternal-september.org> <s8k76l$1j8l$1@gioia.aioe.org> <60b09b34.1667671@news.eternal-september.org> <s8qk23$7vn$1@dont-email.me> <s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me> <2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me> <2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me> <2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me> <s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com>
Subject: Re: R-related words definition (was: Odd cases of undefined interpretation semantics)
From: hheinric...@gmail.com (Heinrich Hohl)
Injection-Date: Sun, 06 Jun 2021 13:17:40 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 34
 by: Heinrich Hohl - Sun, 6 Jun 2021 13:17 UTC

On Saturday, June 5, 2021 at 2:31:40 PM UTC+2, Anton Ertl wrote:
> >The capability to redefine words is very important in Forth, I believe.
> We have SYNONYM for that, so in theory we should be able to do
>
> synonym >r1 >r : foo [ ' >r1 compile, ] r> ; 1 foo . \ prints 1
>
> In practice it works on Gforth and VFX 5.11. The version of iForth I
> use does not have SYNONYM, and SwiftForth has a broken implementation.

a) It depends. Redefining words using SYNONYM can be useful sometimes.

However, if I would want to redefine a troublesome word, I would just use SEE to look up
the code of the original word and define the new word using the same code.

In your example you want to redefine >R under the new name >R1.
In SwiftForth, >R is just a tiny assembly instruction (4 Intel instructions). Defining >R1
again instead of using a synonym may cost you a few bytes. But on the other hand you can be sure
that the new word works as intended; it does not need sophisticated testing for special cases.

b) In order to create synonyms, SwiftForth always had the word AKA which is super simple:
: AKA ( -- ) ' >CODE HEADER ,JMP ;
\ AKA <old> <new>

My only gripe with AKA is that it expects the two arguments in the wrong order.
The following definition makes more sense and is good enough for my needs:
: ALIAS ( -- ) HEADER ' >CODE ,JMP ;
\ ALIAS <new> <old>

c) SwiftForth has added SYNONYM recently, in SF version 3.11.0. This word has a more
complicated definition than ALIAS, but it handles special cases where ALIAS would fail.

I have tested SYNONYM and did not see anything wrong with it. Can you please tell me
why you think the implementation is broken? In a meaningful example?

Henry

Re: R-related words definition

<s9iqvc$chl$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13412&group=comp.lang.forth#13412

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: R-related words definition
Date: Sun, 6 Jun 2021 18:52:11 +0300
Organization: A noiseless patient Spider
Lines: 89
Message-ID: <s9iqvc$chl$1@dont-email.me>
References: <s6a8o8$va3$1@gioia.aioe.org>
<60acbca4.512609@news.eternal-september.org> <s8k76l$1j8l$1@gioia.aioe.org>
<60b09b34.1667671@news.eternal-september.org> <s8qk23$7vn$1@dont-email.me>
<s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me>
<2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me>
<2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me>
<2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me>
<s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
<s9g59j$asv$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 6 Jun 2021 15:52:12 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e85b79ec1469e7ac5ca2f0377888bddf";
logging-data="12853"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XxTrSUOZh5kiwdUyVOk+9"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:aNST1FARP5hhvMLJ4q2cBPrgN/A=
In-Reply-To: <s9g59j$asv$1@dont-email.me>
Content-Language: en-US
X-Mozilla-News-Host: news://nntp.aioe.org
 by: Ruvim - Sun, 6 Jun 2021 15:52 UTC

On 2021-06-05 18:29, Ruvim wrote:
> On 2021-06-05 14:55, Anton Ertl wrote:
>> Ruvim <ruvim.pinka@gmail.com> writes:
>>> On 2021-06-04 10:15, Ruvim wrote:
>>>> On 2021-05-30 19:59, Anton Ertl wrote:
[...]
>>>>> and delete the undefinition of the interpretation semantics of >R etc.
>>>>>
>>>>> This would make
>>>>>
>>>>> : foo [ ' >r compile, ] r> ;
>>>>>
>>>>> standard.
>>>>
>>>> I dislike this latter idea, since it makes nonstandard the existing
>>>> dual-semantics implementations for R-words.
[...]
>>> One more problem with this approach is an inconsistency concerning
>>> redefinitions.
>>>
[...]
>> Let's ignore SYNONYM for no: Then the question is whether the
>> programmers are better off if they cannot COMPILE, the xt of >R at
>> all, than if they can do it, but cannot define a word with the same
>> capability?
>
> This dilemma is incorrect.
>
> 1. At the moment, the programmers cannot obtain xt of ">R", so they also
> cannot apply "COMPILE," to it.
>
> 2. The programmers don't need to compile the xt of ">R", actually they
> need to append the run-time semantics of ">R".
>
> 3. In any case, they can append these semantics via "POSTPONE >R"
>
> 4. The problem of redefinition is not only in a word with the same
> semantics, but it is also in a word with additional (hidden) semantics.
> E.g., for logging, checking a stack balance, debugging, etc.
>
> 5. Redefinitions that work before that, will be incompatible with the
> new code (that may tick ">R").
>
>
> Thus, the programmers will lost ability for redefinition, and they won't
> get anything new in return, just one *additional* way to append run-time
> semantics of ">R".

One more argument: There is no much sense to remove prohibition of
obtaining xt for a word, if you cannot apply "execute" to the returned
xt anyway.

An example for the item 5 above is my "c-state" library[1] to support
multiple compilation (or postponing) levels.

It redefines ">R" (and many other words) in the following way:

: >r [: postpone >r ;] et-xt ; immediate

This standard code is incompatible with a program that may tick ">R".

[1] The redefinitions (wrappers) are in the "c-state.wrappers.fth" file
at https://git.io/JZvco

>> For the FIND-based user-defined text interpreter there is also the
>> issue that FIND returns -1 for >R on many systems, and in compile
>> state that text-interpreter then calls COMPILE, for the xt returned by
>> FIND.
>
> Why do you think that it's an issue?
>
> It's allowed and compatible at the moment.
>
> In the general case, when "FIND" is applied to the ">R" string, an xt
> that it returns in compilation state is not the xt for the ">R" word.
> It's the xt of an internal definition that serves to perform the
> compilation semantics for the ">R" word.
>

--
Ruvim

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<s9j18q$1er3$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13414&group=comp.lang.forth#13414

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: R-related words definition (was: Odd cases of undefined
interpretation semantics)
Date: Mon, 7 Jun 2021 03:39:38 +1000
Organization: Aioe.org NNTP Server
Lines: 9
Message-ID: <s9j18q$1er3$1@gioia.aioe.org>
References: <s6a8o8$va3$1@gioia.aioe.org>
<60acbca4.512609@news.eternal-september.org> <s8k76l$1j8l$1@gioia.aioe.org>
<60b09b34.1667671@news.eternal-september.org> <s8qk23$7vn$1@dont-email.me>
<s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me>
<2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me>
<2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me>
<2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me>
<s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
<11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com>
NNTP-Posting-Host: xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Sun, 6 Jun 2021 17:39 UTC

On 6/06/2021 23:17, Heinrich Hohl wrote:
> ...
> b) In order to create synonyms, SwiftForth always had the word AKA which is super simple:
> : AKA ( -- ) ' >CODE HEADER ,JMP ;
> \ AKA <old> <new>
>
> My only gripe with AKA is that it expects the two arguments in the wrong order.

“Freedom is the freedom to say that two plus two make four."

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<2021Jun6.182455@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13415&group=comp.lang.forth#13415

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: R-related words definition (was: Odd cases of undefined interpretation semantics)
Date: Sun, 06 Jun 2021 16:24:55 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 80
Message-ID: <2021Jun6.182455@mips.complang.tuwien.ac.at>
References: <s6a8o8$va3$1@gioia.aioe.org> <s8qk23$7vn$1@dont-email.me> <s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me> <2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me> <2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me> <2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me> <s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at> <11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="dad645ad30d83d5811e19d40b5ff2bbf";
logging-data="32653"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+sVVwchbGL2q/Sa7hwqVTz"
Cancel-Lock: sha1:qpGzshv7cXBKS93stKaAnRzATxg=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 6 Jun 2021 16:24 UTC

Heinrich Hohl <hheinrich.hohl@gmail.com> writes:
>On Saturday, June 5, 2021 at 2:31:40 PM UTC+2, Anton Ertl wrote:
>> >The capability to redefine words is very important in Forth, I believe.
>> We have SYNONYM for that, so in theory we should be able to do
>>
>> synonym >r1 >r : foo [ ' >r1 compile, ] r> ; 1 foo . \ prints 1
>>
>> In practice it works on Gforth and VFX 5.11. The version of iForth I
>> use does not have SYNONYM, and SwiftForth has a broken implementation.
>
>a) It depends. Redefining words using SYNONYM can be useful sometimes.
>
>However, if I would want to redefine a troublesome word, I would just use SEE to look up
> the code of the original word and define the new word using the same code.
>
>In your example you want to redefine >R under the new name >R1.
>In SwiftForth, >R is just a tiny assembly instruction (4 Intel instructions). Defining >R1
>again instead of using a synonym may cost you a few bytes. But on the other hand you can be sure
>that the new word works as intended; it does not need sophisticated testing for special cases.

Let's see:

: foo [ ' >r compile, ] r> ; 1 foo .

works on SwiftForth 3.11.

I define >R1 using the source code definition of >R:

ICODE >R1 ( x -- ) ( R: -- x )
EBX PUSH POP(EBX) RET END-CODE

: foo1 [ ' >r1 compile, ] r> ; 1 foo1 .

This works, too. Great! I guess the ICODE (instead of CODE) means
that COMPILE, inlines the code.

>b) In order to create synonyms, SwiftForth always had the word AKA which is super simple:
>: AKA ( -- ) ' >CODE HEADER ,JMP ;
>\ AKA <old> <new>

Starting with a fresh SwiftForth 3.11, I type in:

aka >r >r1 : foo [ ' >r1 compile, ] r> ; 1 foo .

This produces a segmentation fault, because FOO calls >R1, and
eventually >R, but SwiftForth's >R is designed to be inlined, not
called. For the same reason, you cannot EXECUTE the xt of >R.

>c) SwiftForth has added SYNONYM recently, in SF version 3.11.0. This word has a more
>complicated definition than ALIAS, but it handles special cases where ALIAS would fail.

And it fails in cases where AKA and ALIAS work.

>I have tested SYNONYM and did not see anything wrong with it. Can you please tell me
>why you think the implementation is broken? In a meaningful example?

It produces STATE-smart words. Short examples tend to be contrived,
and meaningful examples tend to be long; I'll go for a short one and
leave it to you to imagine a meaningful one:

: foo1 ." foo" ;
synonym foo2 foo1
defer bar immediate
' foo1 is bar
: bla1 bar ; \ prints "foo"
bla1 \ prints nothing
' foo2 is bar
: bla2 bar ; \ prints "foo"
bla2 \ prints nothing

Works in development Gforth and VFX 5.11, but the output of the last
two lines is wrong in SwiftForth. I.e., FOO2 does not behave as
SYNONYM in SwiftForth.

- 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 2021: https://euro.theforth.net/2021

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<a71cbf55-b3cc-4b70-94fa-b9a652bafc0cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13417&group=comp.lang.forth#13417

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5351:: with SMTP id d17mr13620479qto.238.1623009814993;
Sun, 06 Jun 2021 13:03:34 -0700 (PDT)
X-Received: by 2002:a05:620a:112d:: with SMTP id p13mr13787770qkk.375.1623009814866;
Sun, 06 Jun 2021 13:03:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 6 Jun 2021 13:03:34 -0700 (PDT)
In-Reply-To: <2021Jun6.182455@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ed:a70f:2f01:9c15:3c61:43b7:432a;
posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:ed:a70f:2f01:9c15:3c61:43b7:432a
References: <s6a8o8$va3$1@gioia.aioe.org> <s8qk23$7vn$1@dont-email.me>
<s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me> <2021May29.110946@mips.complang.tuwien.ac.at>
<s8tspk$dbd$1@dont-email.me> <2021May29.193617@mips.complang.tuwien.ac.at>
<s8vgq8$n9t$1@dont-email.me> <2021May30.185919@mips.complang.tuwien.ac.at>
<s9cjts$jae$1@dont-email.me> <s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
<11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com> <2021Jun6.182455@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a71cbf55-b3cc-4b70-94fa-b9a652bafc0cn@googlegroups.com>
Subject: Re: R-related words definition (was: Odd cases of undefined
interpretation semantics)
From: hheinric...@gmail.com (Heinrich Hohl)
Injection-Date: Sun, 06 Jun 2021 20:03:34 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Heinrich Hohl - Sun, 6 Jun 2021 20:03 UTC

On Sunday, June 6, 2021 at 7:55:01 PM UTC+2, Anton Ertl wrote:
> Starting with a fresh SwiftForth 3.11, I type in:
> : foo1 ." foo" ;
> synonym foo2 foo1
> defer bar immediate
> ' foo1 is bar
> : bla1 bar ; \ prints "foo"
> bla1 \ prints nothing
> ' foo2 is bar
> : bla2 bar ; \ prints "foo"
> bla2 \ prints nothing

Hello Anton,

thank you for the explanations. These are simple but good examples.

Now I see the shortcomings in SwiftForth's SYNONYM. And it is quite
surprising that the much simpler AKA handles these examples properly.
I have learned something today!

Henry

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<4742646a-5d73-4dcb-8640-a40a74a1d0cbn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13420&group=comp.lang.forth#13420

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5fd5:: with SMTP id k21mr14680581qta.231.1623029542099; Sun, 06 Jun 2021 18:32:22 -0700 (PDT)
X-Received: by 2002:ac8:7757:: with SMTP id g23mr9827780qtu.286.1623029541889; Sun, 06 Jun 2021 18:32:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.uzoreto.com!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 6 Jun 2021 18:32:21 -0700 (PDT)
In-Reply-To: <s9ffms$spn$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=148.167.132.245; posting-account=OxDKOgoAAADW0cxAqHqpN1zqeCoSsDap
NNTP-Posting-Host: 148.167.132.245
References: <s6a8o8$va3$1@gioia.aioe.org> <s8fok1$9tj$1@gioia.aioe.org> <1p9ojmn.1ltc322xcydw9N%awegel@arcor.de> <s8hk3s$1472$1@gioia.aioe.org> <60acbca4.512609@news.eternal-september.org> <s8k76l$1j8l$1@gioia.aioe.org> <60b09b34.1667671@news.eternal-september.org> <s8qk23$7vn$1@dont-email.me> <s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me> <2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me> <2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me> <2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me> <s9ffms$spn$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4742646a-5d73-4dcb-8640-a40a74a1d0cbn@googlegroups.com>
Subject: Re: R-related words definition (was: Odd cases of undefined interpretation semantics)
From: hughagui...@gmail.com (Hugh Aguilar)
Injection-Date: Mon, 07 Jun 2021 01:32:22 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 56
 by: Hugh Aguilar - Mon, 7 Jun 2021 01:32 UTC

On Saturday, June 5, 2021 at 2:21:34 AM UTC-7, Ruvim wrote:
> An R-related word can be redefined only as an immediate word.
> E.g.:
>
> : exit ( some stuff ) postpone exit ; immediate
> : >r ( some stuff ) postpone >r ; immediate

Ruvim has invented disambiguifiers!

Here are some disambiguifiers from the novice-package (there are 53 disambiguifiers total):
: exit state @ 0= abort" *** no interpretation semantics for: EXIT ***"
postpone exit ; immediate
: >r state @ 0= abort" *** no interpretation semantics for: >R ***"
postpone >r ; immediate

> And after such a redefinition, the phrase
> ['] >r compile,
> or
> [ ' >r compile, ]
>
> produces the different effects than before the redefinition.

They are called "disambiguifiers" because they produce the same result
for all ANS-Forth implementations. Previously, these words were ambiguous
so they produced different results for various ANS-Forth implementations.
In some cases (but not other cases) the effect of the disambiguifier will be
different from that of the raw ANS-Forth word.
This is not a problem --- just ignore raw ANS-Forth and always assume that
you have the disambiguifiers, so you always get the same result.

> It's the same problem as about "[compile]", when the phrase
> [compile] exit
>
> produces the different effects after a redefinition of "exit", than
> before the redefinition.

It's the same problem with all 53 ambiguous words in ANS-Forth.

You seem to be stuck trying to figure out certain words, such as EXIT
and >R --- you don't realize that this is a general problem in ANS-Forth

> The capability to redefine words is very important in Forth, I believe.

Well, yeah!

> If we want to keep this capability, the standard should not allow to
> obtain the execution token for R-related words (regardless of the
> definition for interpretation semantics for them), since that produces
> an intrinsic inconsistency.

Bullshit!
ANS-Forth's ambiguity in FIND can be fixed with the disambiguifiers.

You are struggling to solve a problem that I solved years ago.
You seem to be on the verge of inventing disambiguifiers though. Yay!
If you do invent disambiguifiers, Elizabeth Rather's Committee of Can't
will tell you that you are no longer a Forth programmer at all.

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<s9k0vr$ntp$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13421&group=comp.lang.forth#13421

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: R-related words definition (was: Odd cases of undefined
interpretation semantics)
Date: Mon, 7 Jun 2021 12:41:01 +1000
Organization: Aioe.org NNTP Server
Lines: 45
Message-ID: <s9k0vr$ntp$1@gioia.aioe.org>
References: <s6a8o8$va3$1@gioia.aioe.org> <s8qk23$7vn$1@dont-email.me>
<s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me>
<2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me>
<2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me>
<2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me>
<s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
<11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com>
<2021Jun6.182455@mips.complang.tuwien.ac.at>
<a71cbf55-b3cc-4b70-94fa-b9a652bafc0cn@googlegroups.com>
NNTP-Posting-Host: xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Mon, 7 Jun 2021 02:41 UTC

On 7/06/2021 06:03, Heinrich Hohl wrote:
> On Sunday, June 6, 2021 at 7:55:01 PM UTC+2, Anton Ertl wrote:
>> Starting with a fresh SwiftForth 3.11, I type in:
>> : foo1 ." foo" ;
>> synonym foo2 foo1
>> defer bar immediate
>> ' foo1 is bar
>> : bla1 bar ; \ prints "foo"
>> bla1 \ prints nothing
>> ' foo2 is bar
>> : bla2 bar ; \ prints "foo"
>> bla2 \ prints nothing
>
> Hello Anton,
>
> thank you for the explanations. These are simple but good examples.
>
> Now I see the shortcomings in SwiftForth's SYNONYM.

It was only recently added. Clearly not fully tested.

> And it is quite
> surprising that the much simpler AKA handles these examples properly.

OTOH their AKA doesn't promote immediacy:

: foo1 ." foo" ; immediate

aka foo1 foo2

: bla1 foo1 ; \ prints "foo"
bla1 \ prints nothing

: bla2 foo2 ; \ prints nothing
bla2 \ prints "foo"

DX-Forth 4.45 2021-04-17

: foo1 ." foo" ; immediate ok
aka foo1 foo2 ok
: bla1 foo1 ; foo ok
bla1 ok
: bla2 foo2 ; foo ok
bla2 ok

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<s9k86f$jba$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13422&group=comp.lang.forth#13422

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: R-related words definition (was: Odd cases of undefined
interpretation semantics)
Date: Mon, 7 Jun 2021 14:43:59 +1000
Organization: Aioe.org NNTP Server
Lines: 30
Message-ID: <s9k86f$jba$1@gioia.aioe.org>
References: <s6a8o8$va3$1@gioia.aioe.org> <s8qk23$7vn$1@dont-email.me>
<s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me>
<2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me>
<2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me>
<2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me>
<s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
<11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com>
<2021Jun6.182455@mips.complang.tuwien.ac.at>
<a71cbf55-b3cc-4b70-94fa-b9a652bafc0cn@googlegroups.com>
NNTP-Posting-Host: xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Mon, 7 Jun 2021 04:43 UTC

On 7/06/2021 06:03, Heinrich Hohl wrote:
> On Sunday, June 6, 2021 at 7:55:01 PM UTC+2, Anton Ertl wrote:
>> Starting with a fresh SwiftForth 3.11, I type in:
>> : foo1 ." foo" ;
>> synonym foo2 foo1
>> defer bar immediate
>> ' foo1 is bar
>> : bla1 bar ; \ prints "foo"
>> bla1 \ prints nothing
>> ' foo2 is bar
>> : bla2 bar ; \ prints "foo"
>> bla2 \ prints nothing
>
> Hello Anton,
>
> thank you for the explanations. These are simple but good examples.
>
> Now I see the shortcomings in SwiftForth's SYNONYM.

Briefly tested but will leave it to others to validate.
There may be a reason why SwiftForth's SYNONYM was so complicated
but I didn't look that far.

: AKA ( "old" "new" -- ) DEFINED TUCK HUH?
HEADER >CODE ,JMP 0> IF IMMEDIATE THEN ;

: SYNONYM ( "new" "old" ) HEADER +SMUDGE DEFINED
TUCK HUH? -SMUDGE >CODE ,JMP 0> IF IMMEDIATE THEN ;

Note: xt of the alias will be different from the original.

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<2021Jun7.082531@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13423&group=comp.lang.forth#13423

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: R-related words definition (was: Odd cases of undefined interpretation semantics)
Date: Mon, 07 Jun 2021 06:25:31 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 22
Message-ID: <2021Jun7.082531@mips.complang.tuwien.ac.at>
References: <s6a8o8$va3$1@gioia.aioe.org> <s8tspk$dbd$1@dont-email.me> <2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me> <2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me> <s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at> <11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com> <2021Jun6.182455@mips.complang.tuwien.ac.at> <a71cbf55-b3cc-4b70-94fa-b9a652bafc0cn@googlegroups.com> <s9k86f$jba$1@gioia.aioe.org>
Injection-Info: reader02.eternal-september.org; posting-host="ed86afcdb01ec50327845b99dac22011";
logging-data="9143"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19YctFHa8Fko/UYCxRozdvl"
Cancel-Lock: sha1:KQs+Qegw2vlzvTOQkVMPv51uXMo=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Mon, 7 Jun 2021 06:25 UTC

dxforth <dxforth@gmail.com> writes:
>There may be a reason why SwiftForth's SYNONYM was so complicated
>but I didn't look that far.

My guess is that the broken Forth-2012 reference implementation led
the SwiftForth implementors astray. See also
<https://forth-standard.org/standard/tools/SYNONYM#reply-554>

>: SYNONYM ( "new" "old" ) HEADER +SMUDGE DEFINED
> TUCK HUH? -SMUDGE >CODE ,JMP 0> IF IMMEDIATE THEN ;

Looks correct to me.

I have sent it (with credits) as s followon to my bug report to Forth,
Inc.

- 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 2021: https://euro.theforth.net/2021

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<41b443d9-7fd5-48ea-94fe-d4ce4fde69dcn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13425&group=comp.lang.forth#13425

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:1502:: with SMTP id e2mr9363903qvy.14.1623067994588; Mon, 07 Jun 2021 05:13:14 -0700 (PDT)
X-Received: by 2002:a05:620a:8cc:: with SMTP id z12mr418304qkz.466.1623067994377; Mon, 07 Jun 2021 05:13:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!aioe.org!news.uzoreto.com!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Mon, 7 Jun 2021 05:13:14 -0700 (PDT)
In-Reply-To: <s9k86f$jba$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ed:a70f:2f01:c48:4dea:34b1:1c23; posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:ed:a70f:2f01:c48:4dea:34b1:1c23
References: <s6a8o8$va3$1@gioia.aioe.org> <s8qk23$7vn$1@dont-email.me> <s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me> <2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me> <2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me> <2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me> <s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at> <11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com> <2021Jun6.182455@mips.complang.tuwien.ac.at> <a71cbf55-b3cc-4b70-94fa-b9a652bafc0cn@googlegroups.com> <s9k86f$jba$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <41b443d9-7fd5-48ea-94fe-d4ce4fde69dcn@googlegroups.com>
Subject: Re: R-related words definition (was: Odd cases of undefined interpretation semantics)
From: hheinric...@gmail.com (Heinrich Hohl)
Injection-Date: Mon, 07 Jun 2021 12:13:14 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 44
 by: Heinrich Hohl - Mon, 7 Jun 2021 12:13 UTC

On Monday, June 7, 2021 at 6:44:02 AM UTC+2, dxforth wrote:
> OTOH their AKA doesn't promote immediacy:

Yes, I also noticed this. But I was not sure if this is a feature or a bug.
In case of immediate words I would have used:

: foo1 ." foo" ; immediate
aka foo1 foo2 immediate

That is, I would have set the precedence bit manually. Of course, this is only
possible if you are aware of the fact that the original word is immediate.

> Briefly tested but will leave it to others to validate.
>
> : AKA ( "old" "new" -- ) DEFINED TUCK HUH?
> HEADER >CODE ,JMP 0> IF IMMEDIATE THEN ;
>
> : SYNONYM ( "new" "old" ) HEADER +SMUDGE DEFINED
> TUCK HUH? -SMUDGE >CODE ,JMP 0> IF IMMEDIATE THEN ;
>
> Note: xt of the alias will be different from the original.

Looks good to me. My plan for today was to extend AKA so that immediate words
are handled automatically. Your definitions work properly and you saved me some time.
Thank you.

I could not see the need for temporary smudging right away, but smudging seems
to be needed to prevent a user error:

Assuming that "yyy" has never been defined, "SYNONYM yyy yyy" would not
trigger an error message. The newly defined "yyy" would just contain a jump
to itself, meaning that executing the word would result in an endless loop.

Your new definition of SYNONYM for SwiftForth looks good to me. It is more
complicated than AKA, but the core of the word is still "HEADER xt >CODE ,JMP".
All the other words are just used to prevent errors and they are executed during
compilation only.

This version of SYNONYM adds the overhead of one JMP instruction to
every synonym, in comparison with the original word. This is ok for me.
In words that are not time-critical (e.g. WORDS), this overhead is irrelevant.
If words are time-critical (e.g. + or INVERT), I would not use SYNONYM
anyway but rather define the new word based on the original word's code.

Henry

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<bb395242-8dd7-4a0b-94f0-e1a5627dcd42n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13426&group=comp.lang.forth#13426

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:693:: with SMTP id 141mr15450792qkg.453.1623071006707;
Mon, 07 Jun 2021 06:03:26 -0700 (PDT)
X-Received: by 2002:a05:6214:1551:: with SMTP id t17mr17658518qvw.50.1623071006538;
Mon, 07 Jun 2021 06:03:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Mon, 7 Jun 2021 06:03:26 -0700 (PDT)
In-Reply-To: <s9k86f$jba$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ed:a70f:2f01:c48:4dea:34b1:1c23;
posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:ed:a70f:2f01:c48:4dea:34b1:1c23
References: <s6a8o8$va3$1@gioia.aioe.org> <s8qk23$7vn$1@dont-email.me>
<s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me> <2021May29.110946@mips.complang.tuwien.ac.at>
<s8tspk$dbd$1@dont-email.me> <2021May29.193617@mips.complang.tuwien.ac.at>
<s8vgq8$n9t$1@dont-email.me> <2021May30.185919@mips.complang.tuwien.ac.at>
<s9cjts$jae$1@dont-email.me> <s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
<11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com> <2021Jun6.182455@mips.complang.tuwien.ac.at>
<a71cbf55-b3cc-4b70-94fa-b9a652bafc0cn@googlegroups.com> <s9k86f$jba$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bb395242-8dd7-4a0b-94f0-e1a5627dcd42n@googlegroups.com>
Subject: Re: R-related words definition (was: Odd cases of undefined
interpretation semantics)
From: hheinric...@gmail.com (Heinrich Hohl)
Injection-Date: Mon, 07 Jun 2021 13:03:26 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Heinrich Hohl - Mon, 7 Jun 2021 13:03 UTC

On Monday, June 7, 2021 at 6:44:02 AM UTC+2, dxforth wrote:
> There may be a reason why SwiftForth's SYNONYM was so complicated
> but I didn't look that far.

I think I can answer that. For this you need to switch off the optimizer.

-OPTIMIZER

AKA + A+
SYNONYM S+ +

: TEST 5 + ;
: ATEST 5 A+ ;
: STEST 5 S+ ;

In SwiftForth, "+" is an inline code definition. Use SEE to investigate what was
compiled into TEST, ATEST and STEST.

You see that the inline code of "+" has been expanded and compiled into TEST.
This gives best speed.
ATEST has compiled a call to "+", meaning that overhead has been added.
STEST has exactly the same code as TEST.

Without the optimizer, SYNONYM will compile better code than AKA
if the synonym refers to an word that was defined using ICODE.
In case of ordinary CODE definitions (e.g. "<") or colon definitions (e.g. WORDS),
there is no difference between AKA and SYNONYM.

Now switch on the optimizer and repeat the test. In this case, the optimizer
produces the same code in all three cases, TEST, ATEST and STEST. No matter
whether the original words was defined using ICODE, CODE or colon.

Taking the SwiftForth optimizer into consideration, it is no longer true that
a synonym based on JMP always introduces overhead. For me this is one more
reason to prefer the definition presented by dxforth over the current version
of SYNONYM in SwiftForth that creates immediate words.

Henry

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<2021Jun7.180511@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13429&group=comp.lang.forth#13429

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: R-related words definition (was: Odd cases of undefined interpretation semantics)
Date: Mon, 07 Jun 2021 16:05:11 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 22
Message-ID: <2021Jun7.180511@mips.complang.tuwien.ac.at>
References: <s6a8o8$va3$1@gioia.aioe.org> <s8vgq8$n9t$1@dont-email.me> <2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me> <s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at> <11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com> <2021Jun6.182455@mips.complang.tuwien.ac.at> <a71cbf55-b3cc-4b70-94fa-b9a652bafc0cn@googlegroups.com> <s9k86f$jba$1@gioia.aioe.org> <41b443d9-7fd5-48ea-94fe-d4ce4fde69dcn@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="ed86afcdb01ec50327845b99dac22011";
logging-data="21875"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18IHxlJTxH6Qrc1D0BgXb+q"
Cancel-Lock: sha1:uCJVUPmqYpXIASMMvOprvJiE0DA=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Mon, 7 Jun 2021 16:05 UTC

Heinrich Hohl <hheinrich.hohl@gmail.com> writes:
>I could not see the need for temporary smudging right away, but smudging seems
>to be needed to prevent a user error:
>
>Assuming that "yyy" has never been defined, "SYNONYM yyy yyy" would not
>trigger an error message. The newly defined "yyy" would just contain a jump
>to itself, meaning that executing the word would result in an endless loop.

The +SMUDGE and -SMUDGE implement the following parts of the SYNONYM
specification:

|Newname may be the same as oldname; when looking up oldname, newname
|shall not be found.

So this is not just about detecting user error.

- 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 2021: https://euro.theforth.net/2021

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<6eca145a-4ce5-43fe-b3ea-dc79458ca45fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13430&group=comp.lang.forth#13430

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:158c:: with SMTP id d12mr9843560qkk.42.1623087508607;
Mon, 07 Jun 2021 10:38:28 -0700 (PDT)
X-Received: by 2002:a05:622a:1714:: with SMTP id h20mr17408140qtk.311.1623087508408;
Mon, 07 Jun 2021 10:38:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Mon, 7 Jun 2021 10:38:28 -0700 (PDT)
In-Reply-To: <2021Jun7.180511@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:e4:e70e:e5db:ada1:4ba:d52a:d5be;
posting-account=mrP5kgoAAADXISqI3e5f4EXLUinHClBq
NNTP-Posting-Host: 2003:e4:e70e:e5db:ada1:4ba:d52a:d5be
References: <s6a8o8$va3$1@gioia.aioe.org> <s8vgq8$n9t$1@dont-email.me>
<2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me>
<s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
<11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com> <2021Jun6.182455@mips.complang.tuwien.ac.at>
<a71cbf55-b3cc-4b70-94fa-b9a652bafc0cn@googlegroups.com> <s9k86f$jba$1@gioia.aioe.org>
<41b443d9-7fd5-48ea-94fe-d4ce4fde69dcn@googlegroups.com> <2021Jun7.180511@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6eca145a-4ce5-43fe-b3ea-dc79458ca45fn@googlegroups.com>
Subject: Re: R-related words definition (was: Odd cases of undefined
interpretation semantics)
From: hheinric...@gmail.com (Heinrich Hohl)
Injection-Date: Mon, 07 Jun 2021 17:38:28 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Heinrich Hohl - Mon, 7 Jun 2021 17:38 UTC

On Monday, June 7, 2021 at 6:07:35 PM UTC+2, Anton Ertl wrote:
> The +SMUDGE and -SMUDGE implement the following parts of the SYNONYM
> specification:
>
> |Newname may be the same as oldname; when looking up oldname, newname
> |shall not be found.
>
> So this is not just about detecting user error.
> - anton
> --

Yes, I see. Without smudge, identical names would lead to recursion. Execution of
the synonym would cause an endless loop.

Henry

Re: R-related words definition (was: Odd cases of undefined interpretation semantics)

<s9moqh$1d57$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13435&group=comp.lang.forth#13435

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: R-related words definition (was: Odd cases of undefined
interpretation semantics)
Date: Tue, 8 Jun 2021 13:40:00 +1000
Organization: Aioe.org NNTP Server
Lines: 12
Message-ID: <s9moqh$1d57$1@gioia.aioe.org>
References: <s6a8o8$va3$1@gioia.aioe.org> <s8qk23$7vn$1@dont-email.me>
<s8qrtm$ufp$1@dont-email.me> <s8snar$n9t$1@dont-email.me>
<2021May29.110946@mips.complang.tuwien.ac.at> <s8tspk$dbd$1@dont-email.me>
<2021May29.193617@mips.complang.tuwien.ac.at> <s8vgq8$n9t$1@dont-email.me>
<2021May30.185919@mips.complang.tuwien.ac.at> <s9cjts$jae$1@dont-email.me>
<s9ffms$spn$1@dont-email.me> <2021Jun5.135558@mips.complang.tuwien.ac.at>
<11c52473-5f17-4b52-8b84-619cff9a4638n@googlegroups.com>
<2021Jun6.182455@mips.complang.tuwien.ac.at>
<a71cbf55-b3cc-4b70-94fa-b9a652bafc0cn@googlegroups.com>
<s9k86f$jba$1@gioia.aioe.org>
<41b443d9-7fd5-48ea-94fe-d4ce4fde69dcn@googlegroups.com>
NNTP-Posting-Host: xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Tue, 8 Jun 2021 03:40 UTC

On 7/06/2021 22:13, Heinrich Hohl wrote:
> On Monday, June 7, 2021 at 6:44:02 AM UTC+2, dxforth wrote:
>> OTOH their AKA doesn't promote immediacy:
>
> Yes, I also noticed this. But I was not sure if this is a feature or a bug.

For most cases (non-immediate words) it's neither - perhaps why it
never became an issue. The 'feature' would be turning an immediate
word into a non-immediate alias - an unusual scenario. IMO the more
like explanation is AKA came from polyForth where space was a premium.
Handling immediate words explicitly wasn't seen as a burden.

Re: Performing compilation semantics, rethinking (was: RFI Q99-027)

<sc4mj3$d7p$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13874&group=comp.lang.forth#13874

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: Performing compilation semantics, rethinking (was: RFI Q99-027)
Date: Wed, 7 Jul 2021 20:00:18 +0300
Organization: A noiseless patient Spider
Lines: 90
Message-ID: <sc4mj3$d7p$2@dont-email.me>
References: <s6a8o8$va3$1@gioia.aioe.org> <s6fgj2$rb0$1@gioia.aioe.org>
<s6gos1$7jf$1@dont-email.me> <s6ifhb$139$1@gioia.aioe.org>
<s6liqg$ia6$1@dont-email.me> <s6nvtm$149e$1@gioia.aioe.org>
<2021May9.172106@mips.complang.tuwien.ac.at> <s7a94j$6ii$1@gioia.aioe.org>
<2021May10.180918@mips.complang.tuwien.ac.at> <s7df2c$1nas$1@gioia.aioe.org>
<2021May11.125143@mips.complang.tuwien.ac.at> <s7fv9c$p2$1@dont-email.me>
<2021May12.115400@mips.complang.tuwien.ac.at> <s7tuok$4vb$1@dont-email.me>
<2021May17.173643@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 7 Jul 2021 17:00:19 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="8d7d121264afed0d78569a3b39199934";
logging-data="13561"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GRvyR2W/w21kwpcscfxnv"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:ifA83e0H2YSp1T32eYn5rmKc/3g=
In-Reply-To: <2021May17.173643@mips.complang.tuwien.ac.at>
Content-Language: en-US
X-Mozilla-News-Host: news://nntp.aioe.org
 by: Ruvim - Wed, 7 Jul 2021 17:00 UTC

On 2021-05-17 18:36, Anton Ertl wrote:
> Ruvim <ruvim.pinka@gmail.com> writes:
[...]

>> "POSTPONE" can be implemented according the specification in any system,
>> as I shown earlier: https://git.io/J30D6
>
> At a quick glance this looks like a variant of the code I discussed in
> <2019Jul18.134124@mips.complang.tuwien.ac.at>

Yes, but I didn't receive your answer to my latest arguments in that
thread, see at:

news:qi6con$1bdk$1@gioia.aioe.org on 2019-08-04
- Subject: Re: Semantics rethinking
- The raw message:
https://groups.google.com/forum/message/raw?msg=comp.lang.forth/vrq2f2XXy1Q/tiuq7hJTFgAJ
- The message in the thread:
https://groups.google.com/g/comp.lang.forth/c/vrq2f2XXy1Q/m/tiuq7hJTFgAJ

> which fails these tests:
> : foo state @ . ; immediate
> : foo1 postpone foo ;
> foo1 \ should print 0 (the current state)

It should not, since it's inconsistent.
So if not relying on a99-027 it shall print a nonzero.

Having this definition for "foo1" and regardless how "foo" is defined, I
believe it's an inconsistency if you allow to perform ES(foo1) in
interpretation state and doesn't hold the equivalence of the phrase:
[ x{ foo1 }
and the phrase:
x{ foo }
in compilation state, where "x{" is defined as:
: x{ '}' parse evaluate ] ; immediate

Your interpretation for the "compilation semantics" notion has this
inconsistency as a consequence, and so this inconsistency is allowed by
your interpretation.

But a99-027 excludes this inconsistency since it disallows to perform
ES(foo1) in interpretation state.

My point is that if we allow ES(foo1) in interpretation state, we should
be consistent and hold the above equivalence.

In my PoC https://git.io/J30D6 this equivalence is held, and foo1 prints
a nonzero.

> : x] ] ; immediate
> : y] postpone x] ;
> : bar [ 2 2 + y] literal . ;
> bar \ should print 4

In my implementation it prints 4 (it can be tested in Gforth too).
But I'm inclined to the idea that it is not obligatory, and moreover,
this code might raise an error.

The compilation semantics for "x]" are to do nothing — since neither
standard program can detect any side effect when "x]" is encountered by
the Forth text interpreter in compilation state. That is, the
compilation semantics for "x]" produce zero side effects.

It means that "postpone x]" should appends semantically nothing to the
current definition. Then, the execution semantics of "y]" are to do
nothing. Then, the interpretation semantics for "y]" are to do nothing too.

And then, the code:

: bar [ 2 2 + y] literal . ;

is ambiguous. Due to "y]" does nothing, "literal" is encountered in
interpretation state, and the interpretation semantics for "literal" are
undefined.

Due to an ambiguous condition, the standard requires nothing from this
code. Hence, the standard doesn't require that "bar" should print 4.

--
Ruvim

Pages:123456789
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor