Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

If you think the system is working, ask someone who's waiting for a prompt.


devel / comp.lang.forth / The difference between STATE and having a current colon definition

SubjectAuthor
* The difference between STATE and having a current colon definitionAnton Ertl
+* Re: The difference between STATE and having a current colon definitionnone
|`* Re: The difference between STATE and having a current colon definitionminforth
| `* Re: The difference between STATE and having a current colondxforth
|  `* Re: The difference between STATE and having a current colonnone
|   `- Re: The difference between STATE and having a current colondxforth
+* Re: The difference between STATE and having a current colon definitionNN
|`* Re: The difference between STATE and having a current colon definitionAnton Ertl
| `* Re: The difference between STATE and having a current colon definitionNN
|  `* Re: The difference between STATE and having a current colon definitionccur...@gmail.com
|   `- Re: The difference between STATE and having a current colon definitionHans Bezemer
`- Re: The difference between STATE and having a current colon definitionHugh Aguilar

1
The difference between STATE and having a current colon definition

<2023Jul31.084315@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24139&group=comp.lang.forth#24139

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: The difference between STATE and having a current colon definition
Date: Mon, 31 Jul 2023 06:43:15 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 40
Message-ID: <2023Jul31.084315@mips.complang.tuwien.ac.at>
Injection-Info: dont-email.me; posting-host="c5e24599171afe883fcb7f0e4e216cb5";
logging-data="3388010"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19U9e2GCi3j0Kqk85RvPmu8"
Cancel-Lock: sha1:360MyyOxwed1XBhaAXFr/PJ1lBs=
X-newsreader: xrn 10.11
 by: Anton Ertl - Mon, 31 Jul 2023 06:43 UTC

In discussions about STATE and STATE-smart words, some participants
have wanted to use STATE as an indicator that there is a current colon
definition, and sometimes even claimed that these two concepts are
indistinguishable. The existence of [ and ] means that you can have
interpret state while there is a current definition, and you can have
compile state while there is no current colon definition. E.g.

: foo [ ' + compile, ] ;
] + [

The first line compiles "+" in interpret state while the definition of
FOO is current.

The second line compiles "+" while there is no current colon
definition.

In development Gforth the system now knows whether there is a current
colon definition, and produces warnings accordingly:

: foo [ ' + compile, ] ; ok

] + [
*terminal*:3:3: warning: Compiling outside a definition ok

Gforth still compiles code in the latter case, so you cannot use

create bar ] + - [

instead of

create bar ' + , ' - ,

as in the ITC days (except if you use gforth-itc).

- 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: https://forth-standard.org/
EuroForth 2023: https://euro.theforth.net/2023

Re: The difference between STATE and having a current colon definition

<nnd$276d29f2$7c3577aa@8db8100c128a17cd>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24140&group=comp.lang.forth#24140

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <2023Jul31.084315@mips.complang.tuwien.ac.at>
logging-data="3388010"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19U9e2GCi3j0Kqk85RvPmu8"
Subject: Re: The difference between STATE and having a current colon definition
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$276d29f2$7c3577aa@8db8100c128a17cd>
Organization: KPN B.V.
Date: Mon, 31 Jul 2023 16:45:41 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe006.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 39
Injection-Date: Mon, 31 Jul 2023 16:45:41 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2714
 by: none - Mon, 31 Jul 2023 14:45 UTC

In article <2023Jul31.084315@mips.complang.tuwien.ac.at>
logging-data="3388010"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19U9e2GCi3j0Kqk85RvPmu8",
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>In discussions about STATE and STATE-smart words, some participants
>have wanted to use STATE as an indicator that there is a current colon
>definition, and sometimes even claimed that these two concepts are
>indistinguishable.

I am a proponent of diminishing the ubiquitiness of STATE.
There is no reason STATE should be inspected in number, or string
or character or lambda denotations (although I do it at present in
ciforth) for they signal their presence by leaving something
on the stack.
As an alternative [ ] are only used to inform the INTERPRET word to do
interpreting or compiling. As soon as a word (e.g. a prefix & that
leaves a character ) leaves something on the stack in compile state
INTERPRET detects this and compiles it as a literal.
Obviously a word can only leave something on the stack while
compiling, if that word is immediate. The data stack can no
longer be used as a compilation stack, so the compilation
stack has to be separate.

So ] [ are messages to the INTERPRET object. If the word STATE
exists, it is only present in the implementation of these three
words.

Those ideas has inspired ciforth to restrict STATE to
] [ INTERPRET LITERAL DLITERAL

>--
>M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: The difference between STATE and having a current colon definition

<9cc06aaa-7b49-4a62-86b0-94baa8adb7ban@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24144&group=comp.lang.forth#24144

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4cf:b0:76c:b401:14ff with SMTP id 15-20020a05620a04cf00b0076cb40114ffmr39506qks.7.1690915364638;
Tue, 01 Aug 2023 11:42:44 -0700 (PDT)
X-Received: by 2002:a05:6808:1986:b0:3a7:26fe:ed3 with SMTP id
bj6-20020a056808198600b003a726fe0ed3mr12691171oib.4.1690915364353; Tue, 01
Aug 2023 11:42:44 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Tue, 1 Aug 2023 11:42:43 -0700 (PDT)
In-Reply-To: <nnd$276d29f2$7c3577aa@8db8100c128a17cd>
Injection-Info: google-groups.googlegroups.com; posting-host=185.124.144.116; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 185.124.144.116
References: <2023Jul31.084315@mips.complang.tuwien.ac.at> <nnd$276d29f2$7c3577aa@8db8100c128a17cd>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9cc06aaa-7b49-4a62-86b0-94baa8adb7ban@googlegroups.com>
Subject: Re: The difference between STATE and having a current colon definition
From: minforth@arcor.de (minforth)
Injection-Date: Tue, 01 Aug 2023 18:42:44 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3011
 by: minforth - Tue, 1 Aug 2023 18:42 UTC

none albert schrieb am Montag, 31. Juli 2023 um 16:45:46 UTC+2:
> In article <2023Jul3...@mips.complang.tuwien.ac.at>
> logging-data="3388010"; mail-complaints-to="ab...@eternal-september.org"; posting-account="U2FsdGVkX19U9e2GCi3j0Kqk85RvPmu8",
> Anton Ertl <an...@mips.complang.tuwien.ac.at> wrote:
> >In discussions about STATE and STATE-smart words, some participants
> >have wanted to use STATE as an indicator that there is a current colon
> >definition, and sometimes even claimed that these two concepts are
> >indistinguishable.
> I am a proponent of diminishing the ubiquitiness of STATE.
> There is no reason STATE should be inspected in number, or string
> or character or lambda denotations (although I do it at present in
> ciforth) for they signal their presence by leaving something
> on the stack.
> As an alternative [ ] are only used to inform the INTERPRET word to do
> interpreting or compiling. As soon as a word (e.g. a prefix & that
> leaves a character ) leaves something on the stack in compile state
> INTERPRET detects this and compiles it as a literal.
> Obviously a word can only leave something on the stack while
> compiling, if that word is immediate. The data stack can no
> longer be used as a compilation stack, so the compilation
> stack has to be separate.
>
> So ] [ are messages to the INTERPRET object. If the word STATE
> exists, it is only present in the implementation of these three
> words.
>
> Those ideas has inspired ciforth to restrict STATE to
> ] [ INTERPRET LITERAL DLITERAL

IMO the standard over-restricts STATE to be a binary flag.

It is trivial to extend it to an integer i.e. a multi-value flag
and encode different compilation environments of [ or ] et al

This would be somewhat similar to "messages to the interpreter".

Re: The difference between STATE and having a current colon definition

<uacgle$3udtr$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24145&group=comp.lang.forth#24145

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: The difference between STATE and having a current colon
definition
Date: Wed, 2 Aug 2023 12:56:47 +1000
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <uacgle$3udtr$1@dont-email.me>
References: <2023Jul31.084315@mips.complang.tuwien.ac.at>
<nnd$276d29f2$7c3577aa@8db8100c128a17cd>
<9cc06aaa-7b49-4a62-86b0-94baa8adb7ban@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 2 Aug 2023 02:56:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7c27edf3620761d649a7398e002ad88a";
logging-data="4143035"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GD69ksyvOV6D0WS0lkNhy"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:cnt2Nh6bxHcFBpX/i/xLNCBBjvo=
Content-Language: en-GB
In-Reply-To: <9cc06aaa-7b49-4a62-86b0-94baa8adb7ban@googlegroups.com>
 by: dxforth - Wed, 2 Aug 2023 02:56 UTC

On 2/08/2023 4:42 am, minforth wrote:
> none albert schrieb am Montag, 31. Juli 2023 um 16:45:46 UTC+2:
>> In article <2023Jul3...@mips.complang.tuwien.ac.at>
>> logging-data="3388010"; mail-complaints-to="ab...@eternal-september.org"; posting-account="U2FsdGVkX19U9e2GCi3j0Kqk85RvPmu8",
>> Anton Ertl <an...@mips.complang.tuwien.ac.at> wrote:
>>> In discussions about STATE and STATE-smart words, some participants
>>> have wanted to use STATE as an indicator that there is a current colon
>>> definition, and sometimes even claimed that these two concepts are
>>> indistinguishable.
>> I am a proponent of diminishing the ubiquitiness of STATE.
>> There is no reason STATE should be inspected in number, or string
>> or character or lambda denotations (although I do it at present in
>> ciforth) for they signal their presence by leaving something
>> on the stack.
>> As an alternative [ ] are only used to inform the INTERPRET word to do
>> interpreting or compiling. As soon as a word (e.g. a prefix & that
>> leaves a character ) leaves something on the stack in compile state
>> INTERPRET detects this and compiles it as a literal.
>> Obviously a word can only leave something on the stack while
>> compiling, if that word is immediate. The data stack can no
>> longer be used as a compilation stack, so the compilation
>> stack has to be separate.
>>
>> So ] [ are messages to the INTERPRET object. If the word STATE
>> exists, it is only present in the implementation of these three
>> words.
>>
>> Those ideas has inspired ciforth to restrict STATE to
>> ] [ INTERPRET LITERAL DLITERAL
>
> IMO the standard over-restricts STATE to be a binary flag.
>
> It is trivial to extend it to an integer i.e. a multi-value flag
> and encode different compilation environments of [ or ] et al
>
> This would be somewhat similar to "messages to the interpreter".

Anyone who has developed a forth will likely have an idea or two how
things could be improved. The TC restricted many things with the aim
of securing general support. ISTM this leaves prospective designers
with two options: risk fragmenting what support still exists for a
standard - or leave for the sake of it and their own sanity.

Re: The difference between STATE and having a current colon definition

<32657581-dac1-4922-bb7e-954992f73b79n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24151&group=comp.lang.forth#24151

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4cf:b0:76c:b401:14ff with SMTP id 15-20020a05620a04cf00b0076cb40114ffmr47673qks.7.1690970557952;
Wed, 02 Aug 2023 03:02:37 -0700 (PDT)
X-Received: by 2002:a05:6870:c79a:b0:1bb:84d0:5b8d with SMTP id
dy26-20020a056870c79a00b001bb84d05b8dmr16579599oab.6.1690970557451; Wed, 02
Aug 2023 03:02:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 2 Aug 2023 03:02:37 -0700 (PDT)
In-Reply-To: <2023Jul31.084315@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23c5:6f05:3a01:9f2a:704a:501f:a817;
posting-account=9A5f7goAAAD_QfJPZnlK3Xq_UhzYjdP-
NNTP-Posting-Host: 2a00:23c5:6f05:3a01:9f2a:704a:501f:a817
References: <2023Jul31.084315@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <32657581-dac1-4922-bb7e-954992f73b79n@googlegroups.com>
Subject: Re: The difference between STATE and having a current colon definition
From: november.nihal@gmail.com (NN)
Injection-Date: Wed, 02 Aug 2023 10:02:37 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3291
 by: NN - Wed, 2 Aug 2023 10:02 UTC

On Monday, 31 July 2023 at 08:07:10 UTC+1, Anton Ertl wrote:
> In discussions about STATE and STATE-smart words, some participants
> have wanted to use STATE as an indicator that there is a current colon
> definition, and sometimes even claimed that these two concepts are
> indistinguishable. The existence of [ and ] means that you can have
> interpret state while there is a current definition, and you can have
> compile state while there is no current colon definition. E.g.
>
> : foo [ ' + compile, ] ;
> ] + [
>
> The first line compiles "+" in interpret state while the definition of
> FOO is current.
>
> The second line compiles "+" while there is no current colon
> definition.
>
> In development Gforth the system now knows whether there is a current
> colon definition, and produces warnings accordingly:
>
> : foo [ ' + compile, ] ; ok
>
> ] + [
> *terminal*:3:3: warning: Compiling outside a definition ok
>
> Gforth still compiles code in the latter case, so you cannot use
>
> create bar ] + - [
>
> instead of
>
> create bar ' + , ' - ,
>
> as in the ITC days (except if you use gforth-itc).
>
> - 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: https://forth-standard.org/
> EuroForth 2023: https://euro.theforth.net/2023

In my opinion, state is really for the compiler decide which action to carry out
next ie execute or compile. I think [ and ] are necessary as sometimes you need
to compute values on the fly.

No one foresaw that in the future someone would think ] + [ should produce an
answer. I think such code falls under the umbrella of undefined behaviour anyway.

Should state mean there's a current definition being compiled ?

It seems a reasonable expectation. But given that Anton's asking I feel its a trick question.
So on that basis it might be easier to have a separate variable keeping tabs on whether we are
compiling a definition or not.

Re: The difference between STATE and having a current colon definition

<nnd$4965d2b3$3ceb663b@e7e17b3c2d5c8ab9>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24153&group=comp.lang.forth#24153

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Re: The difference between STATE and having a current colon
definition
References: <2023Jul31.084315@mips.complang.tuwien.ac.at> <nnd$276d29f2$7c3577aa@8db8100c128a17cd> <9cc06aaa-7b49-4a62-86b0-94baa8adb7ban@googlegroups.com> <uacgle$3udtr$1@dont-email.me>
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$4965d2b3$3ceb663b@e7e17b3c2d5c8ab9>
Organization: KPN B.V.
Date: Wed, 02 Aug 2023 15:04:15 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe005.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 66
Injection-Date: Wed, 02 Aug 2023 15:04:15 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 4134
 by: none - Wed, 2 Aug 2023 13:04 UTC

In article <uacgle$3udtr$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
>On 2/08/2023 4:42 am, minforth wrote:
>> none albert schrieb am Montag, 31. Juli 2023 um 16:45:46 UTC+2:
>>> In article <2023Jul3...@mips.complang.tuwien.ac.at>
>>> logging-data="3388010";
>mail-complaints-to="ab...@eternal-september.org";
>posting-account="U2FsdGVkX19U9e2GCi3j0Kqk85RvPmu8",
>>> Anton Ertl <an...@mips.complang.tuwien.ac.at> wrote:
>>>> In discussions about STATE and STATE-smart words, some participants
>>>> have wanted to use STATE as an indicator that there is a current colon
>>>> definition, and sometimes even claimed that these two concepts are
>>>> indistinguishable.
>>> I am a proponent of diminishing the ubiquitiness of STATE.
>>> There is no reason STATE should be inspected in number, or string
>>> or character or lambda denotations (although I do it at present in
>>> ciforth) for they signal their presence by leaving something
>>> on the stack.
>>> As an alternative [ ] are only used to inform the INTERPRET word to do
>>> interpreting or compiling. As soon as a word (e.g. a prefix & that
>>> leaves a character ) leaves something on the stack in compile state
>>> INTERPRET detects this and compiles it as a literal.
>>> Obviously a word can only leave something on the stack while
>>> compiling, if that word is immediate. The data stack can no
>>> longer be used as a compilation stack, so the compilation
>>> stack has to be separate.
>>>
>>> So ] [ are messages to the INTERPRET object. If the word STATE
>>> exists, it is only present in the implementation of these three
>>> words.
>>>
>>> Those ideas has inspired ciforth to restrict STATE to
>>> ] [ INTERPRET LITERAL DLITERAL
>>
>> IMO the standard over-restricts STATE to be a binary flag.
>>
>> It is trivial to extend it to an integer i.e. a multi-value flag
>> and encode different compilation environments of [ or ] et al
>>
>> This would be somewhat similar to "messages to the interpreter".
>
>Anyone who has developed a forth will likely have an idea or two how
>things could be improved. The TC restricted many things with the aim
>of securing general support. ISTM this leaves prospective designers
>with two options: risk fragmenting what support still exists for a
>standard - or leave for the sake of it and their own sanity.
>
I hope it is clear that I want to go on the other direction.
In the ciforth model STATE is absolutely standard, but its use
is discouraged. The last thing I want to do is assign other functions
to STATE.
The main reason we want to have STATE is ABORT" ." and some such.
The splitting of ." into ." and .( and CHAR into CHAR and [CHAR]
and CTRL into CTRL and [CTRL] is highly artificial and S" is a pitfall.

The solution is to have strings delimited by double quotes that are
valid in execution and compilation mode, similar to what we are accustomed
to with numbers, and compatible with every sane computer language.
Fortunately they have made it into the 2012 standard.

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: The difference between STATE and having a current colon definition

<uadvok$5fi3$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24155&group=comp.lang.forth#24155

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: The difference between STATE and having a current colon
definition
Date: Thu, 3 Aug 2023 02:20:36 +1000
Organization: A noiseless patient Spider
Lines: 78
Message-ID: <uadvok$5fi3$1@dont-email.me>
References: <2023Jul31.084315@mips.complang.tuwien.ac.at>
<nnd$276d29f2$7c3577aa@8db8100c128a17cd>
<9cc06aaa-7b49-4a62-86b0-94baa8adb7ban@googlegroups.com>
<uacgle$3udtr$1@dont-email.me> <nnd$4965d2b3$3ceb663b@e7e17b3c2d5c8ab9>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 2 Aug 2023 16:20:36 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7c27edf3620761d649a7398e002ad88a";
logging-data="179779"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18d3IMZ7tQ3zrO8bTCtt/ZX"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:SLMt5wTTYBeUXGnH2PVbo1YtTlI=
Content-Language: en-GB
In-Reply-To: <nnd$4965d2b3$3ceb663b@e7e17b3c2d5c8ab9>
 by: dxforth - Wed, 2 Aug 2023 16:20 UTC

On 2/08/2023 11:04 pm, albert wrote:
> In article <uacgle$3udtr$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
>> On 2/08/2023 4:42 am, minforth wrote:
>>> none albert schrieb am Montag, 31. Juli 2023 um 16:45:46 UTC+2:
>>>> In article <2023Jul3...@mips.complang.tuwien.ac.at>
>>>> logging-data="3388010";
>> mail-complaints-to="ab...@eternal-september.org";
>> posting-account="U2FsdGVkX19U9e2GCi3j0Kqk85RvPmu8",
>>>> Anton Ertl <an...@mips.complang.tuwien.ac.at> wrote:
>>>>> In discussions about STATE and STATE-smart words, some participants
>>>>> have wanted to use STATE as an indicator that there is a current colon
>>>>> definition, and sometimes even claimed that these two concepts are
>>>>> indistinguishable.
>>>> I am a proponent of diminishing the ubiquitiness of STATE.
>>>> There is no reason STATE should be inspected in number, or string
>>>> or character or lambda denotations (although I do it at present in
>>>> ciforth) for they signal their presence by leaving something
>>>> on the stack.
>>>> As an alternative [ ] are only used to inform the INTERPRET word to do
>>>> interpreting or compiling. As soon as a word (e.g. a prefix & that
>>>> leaves a character ) leaves something on the stack in compile state
>>>> INTERPRET detects this and compiles it as a literal.
>>>> Obviously a word can only leave something on the stack while
>>>> compiling, if that word is immediate. The data stack can no
>>>> longer be used as a compilation stack, so the compilation
>>>> stack has to be separate.
>>>>
>>>> So ] [ are messages to the INTERPRET object. If the word STATE
>>>> exists, it is only present in the implementation of these three
>>>> words.
>>>>
>>>> Those ideas has inspired ciforth to restrict STATE to
>>>> ] [ INTERPRET LITERAL DLITERAL
>>>
>>> IMO the standard over-restricts STATE to be a binary flag.
>>>
>>> It is trivial to extend it to an integer i.e. a multi-value flag
>>> and encode different compilation environments of [ or ] et al
>>>
>>> This would be somewhat similar to "messages to the interpreter".
>>
>> Anyone who has developed a forth will likely have an idea or two how
>> things could be improved. The TC restricted many things with the aim
>> of securing general support. ISTM this leaves prospective designers
>> with two options: risk fragmenting what support still exists for a
>> standard - or leave for the sake of it and their own sanity.
>>
> I hope it is clear that I want to go on the other direction.
> In the ciforth model STATE is absolutely standard, but its use
> is discouraged. The last thing I want to do is assign other functions
> to STATE.
> The main reason we want to have STATE is ABORT" ." and some such.
> The splitting of ." into ." and .(

State-smartness was about convenience. I got tired of typing .( for no
benefit whatsoever.

> and CHAR into CHAR and [CHAR]
> and CTRL into CTRL and [CTRL]

That was existing practice by Forth Inc. Also a fine example of factoring.
Thus far they haven't bugged me.

> S" is a pitfall.

it is now thanks to the differing camps
> The solution is to have strings delimited by double quotes that are
> valid in execution and compilation mode, similar to what we are accustomed
> to with numbers, and compatible with every sane computer language.
> Fortunately they have made it into the 2012 standard.

Prefixed numbers are common outside forth as are C style escapes in strings.
This is no particular reason to use them.

"The fact that an opinion has been widely held is no evidence whatever
that it is not utterly absurd." - Bertrand Russell

Re: The difference between STATE and having a current colon definition

<2023Aug2.183502@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24157&group=comp.lang.forth#24157

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: The difference between STATE and having a current colon definition
Date: Wed, 02 Aug 2023 16:35:02 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 75
Message-ID: <2023Aug2.183502@mips.complang.tuwien.ac.at>
References: <2023Jul31.084315@mips.complang.tuwien.ac.at> <32657581-dac1-4922-bb7e-954992f73b79n@googlegroups.com>
Injection-Info: dont-email.me; posting-host="883f522f72f3a64e2d4eadd60205df91";
logging-data="209734"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19n145s6YSlPS3NFOnurZuk"
Cancel-Lock: sha1:7ICETHUL2F+L6jFt7SDE87+f2Aw=
X-newsreader: xrn 10.11
 by: Anton Ertl - Wed, 2 Aug 2023 16:35 UTC

NN <november.nihal@gmail.com> writes:
>In my opinion, state is really for the compiler decide which action to carry out
>next ie execute or compile.

In a standard system it actually tells the text interpreter whether to
perform the interpretation or compilation semantics of the
text-interpreted word.

The difference between what I wrote and what you wrote (or some other
positions) has been the source of many discussions over the years.

>No one foresaw that in the future someone would think ] + [ should produce an
>answer.

It's not clear which future you have in mind. The technique

of writing

| create bar ] + - [
|
|instead of
|
| create bar ' + , ' - ,

has been used in indirect-threaded code systems and has been thought
of an explicitly rejected by Forth-94 ff.

>I think such code falls under the umbrella of undefined behaviour anyway.

In standard Forth, "ambiguous condition". But a high-quality Forth
system should still behave sensibly. A recent case, which actually
inspired this thread, uncovered that the following sequence

] drop [ : foo 100 ;

resulted in a corrupt FOO (in gforth-fast):

123 foo .s <1> 100

I.e., the "] drop [" influenced what is compiled in the colon
definition. Despite this (and the case that made us find the problem)
being ambiguous conditions, we still considered Gforth's behaviour a
bug, fixed it, and, in addition, added a warning when compiling code
outside a colon definition.

>Should state mean there's a current definition being compiled ?

No. Admittedly in most cases the compilation semantics of a word
compiles some code, so performing them outside a colon definition is
an ambiguous condition, but:

1) There are also standard words whose compilation semantics do not
compile some code, and you can add more such words. E.g.:

: foo ." foo" ; immediate
] foo [ \ prints "foo"

2) Just because we are in interpretation state does not mean that no
code is being compiled:

: bar postpone drop ;
bar

>But given that Anton's asking I feel its a trick question.

It seems to me that you were asking. I discussed and demonstrated the
difference between the concepts, and your question has inspired me to
some more discussion and demonstrations.

- 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: https://forth-standard.org/
EuroForth 2023: https://euro.theforth.net/2023

Re: The difference between STATE and having a current colon definition

<7fcd128d-ebf1-4f6c-a83b-0366cd03b846n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24158&group=comp.lang.forth#24158

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:1994:b0:40f:bec4:b0a6 with SMTP id u20-20020a05622a199400b0040fbec4b0a6mr50520qtc.6.1690998014980;
Wed, 02 Aug 2023 10:40:14 -0700 (PDT)
X-Received: by 2002:a05:6870:d899:b0:1a6:d518:f72c with SMTP id
dv25-20020a056870d89900b001a6d518f72cmr17421151oab.11.1690998014772; Wed, 02
Aug 2023 10:40:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 2 Aug 2023 10:40:14 -0700 (PDT)
In-Reply-To: <2023Jul31.084315@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=98.191.126.242; posting-account=OxDKOgoAAADW0cxAqHqpN1zqeCoSsDap
NNTP-Posting-Host: 98.191.126.242
References: <2023Jul31.084315@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7fcd128d-ebf1-4f6c-a83b-0366cd03b846n@googlegroups.com>
Subject: Re: The difference between STATE and having a current colon definition
From: hughaguilar96@gmail.com (Hugh Aguilar)
Injection-Date: Wed, 02 Aug 2023 17:40:14 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2069
 by: Hugh Aguilar - Wed, 2 Aug 2023 17:40 UTC

On Monday, July 31, 2023 at 12:07:10 AM UTC-7, Anton Ertl wrote:
> In discussions about STATE and STATE-smart words, some participants
> have wanted to use STATE as an indicator that there is a current colon
> definition, and sometimes even claimed that these two concepts are
> indistinguishable. The existence of [ and ] means that you can have
> interpret state while there is a current definition, and you can have
> compile state while there is no current colon definition. E.g.
>
> : foo [ ' + compile, ] ;
> ] + [
>
> The first line compiles "+" in interpret state while the definition of
> FOO is current.
>
> The second line compiles "+" while there is no current colon
> definition.

This topic has already been discussed:
https://groups.google.com/g/comp.lang.forth/c/y96tQf_iOSk/m/WhpmjMTeAgAJ

Re: The difference between STATE and having a current colon definition

<a0669c69-54f4-4fb7-8c1c-146fd693cb0fn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24159&group=comp.lang.forth#24159

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:910:b0:63c:f945:5b09 with SMTP id dj16-20020a056214091000b0063cf9455b09mr85661qvb.12.1691013486723;
Wed, 02 Aug 2023 14:58:06 -0700 (PDT)
X-Received: by 2002:a05:6808:221c:b0:3a7:61dd:f3d4 with SMTP id
bd28-20020a056808221c00b003a761ddf3d4mr1518619oib.5.1691013486457; Wed, 02
Aug 2023 14:58:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 2 Aug 2023 14:58:06 -0700 (PDT)
In-Reply-To: <2023Aug2.183502@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23c5:6f05:3a01:7f8c:7325:a797:4fba;
posting-account=9A5f7goAAAD_QfJPZnlK3Xq_UhzYjdP-
NNTP-Posting-Host: 2a00:23c5:6f05:3a01:7f8c:7325:a797:4fba
References: <2023Jul31.084315@mips.complang.tuwien.ac.at> <32657581-dac1-4922-bb7e-954992f73b79n@googlegroups.com>
<2023Aug2.183502@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a0669c69-54f4-4fb7-8c1c-146fd693cb0fn@googlegroups.com>
Subject: Re: The difference between STATE and having a current colon definition
From: november.nihal@gmail.com (NN)
Injection-Date: Wed, 02 Aug 2023 21:58:06 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 5499
 by: NN - Wed, 2 Aug 2023 21:58 UTC

On Wednesday, 2 August 2023 at 18:20:59 UTC+1, Anton Ertl wrote:
> NN <novembe...@gmail.com> writes:
> >In my opinion, state is really for the compiler decide which action to carry out
> >next ie execute or compile.
> In a standard system it actually tells the text interpreter whether to
> perform the interpretation or compilation semantics of the
> text-interpreted word.
>
> The difference between what I wrote and what you wrote (or some other
> positions) has been the source of many discussions over the years.
> >No one foresaw that in the future someone would think ] + [ should produce an
> >answer.
> It's not clear which future you have in mind. The technique
>
> of writing
> | create bar ] + - [
> |
> |instead of
> |
> | create bar ' + , ' - ,
> has been used in indirect-threaded code systems and has been thought
> of an explicitly rejected by Forth-94 ff.
> >I think such code falls under the umbrella of undefined behaviour anyway.
> In standard Forth, "ambiguous condition". But a high-quality Forth
> system should still behave sensibly. A recent case, which actually
> inspired this thread, uncovered that the following sequence
>
> ] drop [ : foo 100 ;
>
> resulted in a corrupt FOO (in gforth-fast):
>
> 123 foo .s <1> 100
>
> I.e., the "] drop [" influenced what is compiled in the colon
> definition. Despite this (and the case that made us find the problem)
> being ambiguous conditions, we still considered Gforth's behaviour a
> bug, fixed it, and, in addition, added a warning when compiling code
> outside a colon definition.
> >Should state mean there's a current definition being compiled ?
> No. Admittedly in most cases the compilation semantics of a word
> compiles some code, so performing them outside a colon definition is
> an ambiguous condition, but:
>
> 1) There are also standard words whose compilation semantics do not
> compile some code, and you can add more such words. E.g.:
>
> : foo ." foo" ; immediate
> ] foo [ \ prints "foo"
>
> 2) Just because we are in interpretation state does not mean that no
> code is being compiled:
>
> : bar postpone drop ;
> bar
> >But given that Anton's asking I feel its a trick question.
> It seems to me that you were asking. I discussed and demonstrated the
> difference between the concepts, and your question has inspired me to
> some more discussion and demonstrations.
> - 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: https://forth-standard.org/
> EuroForth 2023: https://euro.theforth.net/2023

Hi Anton,

(1) I should have been more precise in my words. When I used compiler I really
meant text interpreter.

(2)

(a) create bar ' + , ' - ,
(b) create bar ] + - [

If the result of (a) and (b) is equivalent then I can see how they might be accepted.
You haven't said how bar is to be used . You could be using bar as a 2variable
I dont know why forth-94 rejected it but I am sure they had their reasons.
(3)

] drop [ : foo 100 ;

I agree with the fix that compiling outside a colon definition should be flagged as it doesn't make sense.
And given that an error is thrown foo wont compile until the prior drop is fixed.

(4)

: foo ." foo" ; immediate
] foo [ \ prints "foo"

This should be rejected as its compilation outside a definition.( as per 3)

(5)

: bar postpone drop ;
bar

This should be rejected as its compilation outside a definition.( as per 3)
The definition should compile, but at the point of 'bar' it should fail.

I have no examples or counter-examples to offer

I am guessing that in the past forth compilers were simple and caught only the
minimal expected to be caught. But as times have moved on and programmers
demand more, the compilers, are being tuned to catch stuff that would have been
allowed to slip by. This in turn has forced compiler writers to question if something
is acceptable code (or not). But just because something is acceptable doesnt
mean its meaningfull code.

Re: The difference between STATE and having a current colon definition

<99680a67-39e8-4b03-8c0d-4ce4483b9685n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24465&group=comp.lang.forth#24465

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:ce6:b0:76d:a991:9184 with SMTP id c6-20020a05620a0ce600b0076da9919184mr176976qkj.15.1693233222736;
Mon, 28 Aug 2023 07:33:42 -0700 (PDT)
X-Received: by 2002:a05:620a:8010:b0:76d:77d4:7a7d with SMTP id
ee16-20020a05620a801000b0076d77d47a7dmr725009qkb.9.1693233222502; Mon, 28 Aug
2023 07:33:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Mon, 28 Aug 2023 07:33:42 -0700 (PDT)
In-Reply-To: <a0669c69-54f4-4fb7-8c1c-146fd693cb0fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=136.226.84.85; posting-account=6vDblwoAAACW49Ffg8eFokdu0AA_JQb0
NNTP-Posting-Host: 136.226.84.85
References: <2023Jul31.084315@mips.complang.tuwien.ac.at> <32657581-dac1-4922-bb7e-954992f73b79n@googlegroups.com>
<2023Aug2.183502@mips.complang.tuwien.ac.at> <a0669c69-54f4-4fb7-8c1c-146fd693cb0fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <99680a67-39e8-4b03-8c0d-4ce4483b9685n@googlegroups.com>
Subject: Re: The difference between STATE and having a current colon definition
From: ccurl609@gmail.com (ccur...@gmail.com)
Injection-Date: Mon, 28 Aug 2023 14:33:42 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1947
 by: ccur...@gmail.com - Mon, 28 Aug 2023 14:33 UTC

IMO, this whole problem goes away if the input is always compiled, and then only executed if a word was not defined.

That can be determined easily enough if LAST changed or not. If LAST changed, don't execute. Else, execute and reset.

Of course, this approach is probably not "ANSI Compliant", but it works for me.

--- something like this:
void go(const char *cp) {
byte *cH=H, *cL=L;
if (parse(cp) == 0) { H=cH; L=cL; return; } // error
if (cL == L) { CComma(RET); H=cH; run(H); }
} ---

In this world, there is no need for a STATE at all.

(I expect some people will have a problem with this ...)

Re: The difference between STATE and having a current colon definition

<a148f216-d109-4d30-8840-41d332984969n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24475&group=comp.lang.forth#24475

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:57ac:0:b0:649:74d0:c0ba with SMTP id g12-20020ad457ac000000b0064974d0c0bamr132031qvx.2.1693330224134;
Tue, 29 Aug 2023 10:30:24 -0700 (PDT)
X-Received: by 2002:a17:90a:bc98:b0:269:4850:5411 with SMTP id
x24-20020a17090abc9800b0026948505411mr6935235pjr.4.1693330223621; Tue, 29 Aug
2023 10:30:23 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Tue, 29 Aug 2023 10:30:22 -0700 (PDT)
In-Reply-To: <99680a67-39e8-4b03-8c0d-4ce4483b9685n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.174.47.232; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 77.174.47.232
References: <2023Jul31.084315@mips.complang.tuwien.ac.at> <32657581-dac1-4922-bb7e-954992f73b79n@googlegroups.com>
<2023Aug2.183502@mips.complang.tuwien.ac.at> <a0669c69-54f4-4fb7-8c1c-146fd693cb0fn@googlegroups.com>
<99680a67-39e8-4b03-8c0d-4ce4483b9685n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a148f216-d109-4d30-8840-41d332984969n@googlegroups.com>
Subject: Re: The difference between STATE and having a current colon definition
From: the.beez.speaks@gmail.com (Hans Bezemer)
Injection-Date: Tue, 29 Aug 2023 17:30:24 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2092
 by: Hans Bezemer - Tue, 29 Aug 2023 17:30 UTC

On Monday, August 28, 2023 at 4:33:44 PM UTC+2, ccur...@gmail.com wrote:
> IMO, this whole problem goes away if the input is always compiled, and then only executed if a word was not defined.
4tH either compiles or executes. It doesn't have a dictionary. A program is like one huge word.

> Of course, this approach is probably not "ANSI Compliant", but it works for me.
I feel you, brother. But you can come pretty close.

> In this world, there is no need for a STATE at all.
Correct. There isn't even a STATE word in 4tH.
> (I expect some people will have a problem with this ...)
... tell me about it <sigh>..

Hans Bezemer

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor