Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

A woman should have compassion. -- Kirk, "Catspaw", stardate 3018.2


devel / comp.lang.forth / error for no apparent reason gforth

SubjectAuthor
* error for no apparent reason gforthfabianor...@gmail.com
+* Re: error for no apparent reason gforthdxforth
|`* Re: error for no apparent reason gforthfabianor...@gmail.com
| `* Re: error for no apparent reason gforthAnton Ertl
|  `* Re: error for no apparent reason gforthfabianor...@gmail.com
|   +* Re: error for no apparent reason gforthdxforth
|   |`- Re: error for no apparent reason gforthfabianor...@gmail.com
|   `- Re: error for no apparent reason gforthAnton Ertl
`* Re: error for no apparent reason gforthAnton Ertl
 +* Re: error for no apparent reason gforthdxforth
 |`- Re: error for no apparent reason gforthAnton Ertl
 +- Re: error for no apparent reason gforthGerry Jackson
 `* Re: error for no apparent reason gforthGerry Jackson
  +* Re: error for no apparent reason gforthminf...@arcor.de
  |+* Re: error for no apparent reason gforthdxforth
  ||+- Re: error for no apparent reason gforthjohn
  ||`* Re: error for no apparent reason gforthminf...@arcor.de
  || `- Re: error for no apparent reason gforthdxforth
  |`* Re: error for no apparent reason gforthGerry Jackson
  | `* Re: error for no apparent reason gforthdxforth
  |  `* Re: error for no apparent reason gforthminf...@arcor.de
  |   `* Re: error for no apparent reason gforthMarcel Hendrix
  |    `* Re: error for no apparent reason gforthminf...@arcor.de
  |     `* Re: error for no apparent reason gforthdxforth
  |      +* Re: error for no apparent reason gforthminf...@arcor.de
  |      |`- Re: error for no apparent reason gforthdxforth
  |      +- Re: error for no apparent reason gforthAnton Ertl
  |      `* Re: error for no apparent reason gforthS Jack
  |       `- Re: error for no apparent reason gforthdxforth
  +- Re: error for no apparent reason gforthjohn
  `* Re: error for no apparent reason gforthAnton Ertl
   `- Re: error for no apparent reason gforthGerry Jackson

Pages:12
error for no apparent reason gforth

<184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:2486:: with SMTP id gi6mr1972915qvb.47.1643259277534;
Wed, 26 Jan 2022 20:54:37 -0800 (PST)
X-Received: by 2002:a05:620a:4084:: with SMTP id f4mr321712qko.327.1643259277410;
Wed, 26 Jan 2022 20:54:37 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Wed, 26 Jan 2022 20:54:37 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=168.121.177.102; posting-account=OMrK2AoAAACPu8JcOP64zhFwVmCz0fk3
NNTP-Posting-Host: 168.121.177.102
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
Subject: error for no apparent reason gforth
From: fabianor...@gmail.com (fabianor...@gmail.com)
Injection-Date: Thu, 27 Jan 2022 04:54:37 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 4
 by: fabianor...@gmail.co - Thu, 27 Jan 2022 04:54 UTC

Hi! i'm starting to learn forth and i'm using gforth and win32forth with the starting forth book.
in the book there is an exercise that suggests doing a word that resets the stack (231--123), however I can do the exercise in win32forth but not in gforth which gives me a stack underflow error.
And in both I tried to create a syntactic sugar word for >R and they gave me an error too.
Why did these errors happen?
thanks.

Re: error for no apparent reason gforth

<sst9rt$lqn$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Thu, 27 Jan 2022 16:16:44 +1100
Organization: Aioe.org NNTP Server
Message-ID: <sst9rt$lqn$1@gioia.aioe.org>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="22359"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Thu, 27 Jan 2022 05:16 UTC

On 27/01/2022 15:54, fabianor...@gmail.com wrote:
> Hi! i'm starting to learn forth and i'm using gforth and win32forth with the starting forth book.
> in the book there is an exercise that suggests doing a word that resets the stack (231--123), however I can do the exercise in win32forth but not in gforth which gives me a stack underflow error.
> And in both I tried to create a syntactic sugar word for >R and they gave me an error too.
> Why did these errors happen?
> thanks.

What was your code? It sounds like you've used >R non-portably.

Re: error for no apparent reason gforth

<2022Jan27.094849@mips.complang.tuwien.ac.at>

  copy mid

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

  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: error for no apparent reason gforth
Date: Thu, 27 Jan 2022 08:48:49 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 32
Message-ID: <2022Jan27.094849@mips.complang.tuwien.ac.at>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="df00b91258d925986056b62bd2d5bc82";
logging-data="23038"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18aDY1uxKJbh4El8soe7EPU"
Cancel-Lock: sha1:hJWywmpCDZ7f1LiDI3ouTesP1IU=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Thu, 27 Jan 2022 08:48 UTC

"fabianor...@gmail.com" <fabianorezende26@gmail.com> writes:
>Hi! i'm starting to learn forth and i'm using gforth and win32forth with the starting forth book.
>in the book there is an exercise that suggests doing a word that resets the stack (231--123), however I can do the exercise in win32forth but not in gforth which gives me a stack underflow error.
>And in both I tried to create a syntactic sugar word for >R and they gave me an error too.
>Why did these errors happen?

As dxforth writes, we need to know exactly what you tried (what you
typed into Gforth, and what error you got) to answer this question.

For stack underflow, there is one generality I can state: gforth (the
debugging engine) reports almost* every stack underflow, most other
Forth systems (including gforth-fast) are less pedantic. E.g.,
starting with an empty stack,

1 swap .

does not report an error on gforth-fast, iforth, lxf, SwiftForth, or
VFX, but reports a stack underflow in gforth.

For the second case, an unknown piece of code producing an unknown
error, I cannot even state generalities.

*There is a relatively newfangled optimization in development Gforth
that compiles "0 +" into nothing, and as a result won't report a stack
underflow when that code is executed starting with an empty stack.

- 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: error for no apparent reason gforth

<ssu15f$78q$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Thu, 27 Jan 2022 22:54:22 +1100
Organization: Aioe.org NNTP Server
Message-ID: <ssu15f$78q$1@gioia.aioe.org>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="7450"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Thu, 27 Jan 2022 11:54 UTC

On 27/01/2022 19:48, Anton Ertl wrote:
>
> *There is a relatively newfangled optimization in development Gforth
> that compiles "0 +" into nothing, and as a result won't report a stack
> underflow when that code is executed starting with an empty stack.

gforth-fast 2020-07-09 does that. What cases prompted you to add it?
I'm aware +FIELD optimizes the 0 offset case but that's handled separately (?)

Re: error for no apparent reason gforth

<cf55742b-e66b-4146-886f-24abf578b3ecn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:1418:: with SMTP id d24mr2231222qkj.513.1643287379619;
Thu, 27 Jan 2022 04:42:59 -0800 (PST)
X-Received: by 2002:ad4:5761:: with SMTP id r1mr2466623qvx.51.1643287379520;
Thu, 27 Jan 2022 04:42:59 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Thu, 27 Jan 2022 04:42:59 -0800 (PST)
In-Reply-To: <sst9rt$lqn$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=168.121.177.102; posting-account=OMrK2AoAAACPu8JcOP64zhFwVmCz0fk3
NNTP-Posting-Host: 168.121.177.102
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com> <sst9rt$lqn$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cf55742b-e66b-4146-886f-24abf578b3ecn@googlegroups.com>
Subject: Re: error for no apparent reason gforth
From: fabianor...@gmail.com (fabianor...@gmail.com)
Injection-Date: Thu, 27 Jan 2022 12:42:59 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 20
 by: fabianor...@gmail.co - Thu, 27 Jan 2022 12:42 UTC

Em quinta-feira, 27 de janeiro de 2022 às 02:16:47 UTC-3, dxforth escreveu:
> On 27/01/2022 15:54, fabianor...@gmail.com wrote:
> > Hi! i'm starting to learn forth and i'm using gforth and win32forth with the starting forth book.
> > in the book there is an exercise that suggests doing a word that resets the stack (231--123), however I can do the exercise in win32forth but not in gforth which gives me a stack underflow error.
> > And in both I tried to create a syntactic sugar word for >R and they gave me an error too.
> > Why did these errors happen?
> > thanks.
>
> What was your code? It sounds like you've used >R non-portably.
: my-word >R ;
1 my-word
*the terminal*:21:7: error: invalid memory adress
1 >>>my-word<<<
Back-trace:
*Terminal*:2:8 0 $6FFFFF877200 ;s

Re: error for no apparent reason gforth

<2022Jan27.141033@mips.complang.tuwien.ac.at>

  copy mid

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

  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: error for no apparent reason gforth
Date: Thu, 27 Jan 2022 13:10:33 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 17
Message-ID: <2022Jan27.141033@mips.complang.tuwien.ac.at>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com> <sst9rt$lqn$1@gioia.aioe.org> <cf55742b-e66b-4146-886f-24abf578b3ecn@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="df00b91258d925986056b62bd2d5bc82";
logging-data="31959"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7hTwTWwvCTs4X4nguaNBg"
Cancel-Lock: sha1:lmJCS3o5tC2N2sG1gTa3u93kTiM=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Thu, 27 Jan 2022 13:10 UTC

"fabianor...@gmail.com" <fabianorezende26@gmail.com> writes:
>: my-word >R ;
>1 my-word
>*the terminal*:21:7: error: invalid memory adress

This pushes 1 on the return stack and then tries to use it as a return
address (i.e., return to address 1). Address 1 is probably no valid
address on your system, so you get an "invalid memory address" error.

What did you want to achieve?

- 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: error for no apparent reason gforth

<85b92e1d-ada2-4a2b-921e-bbffaefdce49n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:2103:: with SMTP id l3mr2412320qkl.493.1643289638161;
Thu, 27 Jan 2022 05:20:38 -0800 (PST)
X-Received: by 2002:a05:620a:1914:: with SMTP id bj20mr2518000qkb.56.1643289638014;
Thu, 27 Jan 2022 05:20:38 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Thu, 27 Jan 2022 05:20:37 -0800 (PST)
In-Reply-To: <2022Jan27.141033@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=168.121.177.102; posting-account=OMrK2AoAAACPu8JcOP64zhFwVmCz0fk3
NNTP-Posting-Host: 168.121.177.102
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<sst9rt$lqn$1@gioia.aioe.org> <cf55742b-e66b-4146-886f-24abf578b3ecn@googlegroups.com>
<2022Jan27.141033@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <85b92e1d-ada2-4a2b-921e-bbffaefdce49n@googlegroups.com>
Subject: Re: error for no apparent reason gforth
From: fabianor...@gmail.com (fabianor...@gmail.com)
Injection-Date: Thu, 27 Jan 2022 13:20:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 18
 by: fabianor...@gmail.co - Thu, 27 Jan 2022 13:20 UTC

Em quinta-feira, 27 de janeiro de 2022 às 10:13:20 UTC-3, Anton Ertl escreveu:
> "fabianor...@gmail.com" <fabianor...@gmail.com> writes:
> >: my-word >R ;
> >1 my-word
> >*the terminal*:21:7: error: invalid memory adress
> This pushes 1 on the return stack and then tries to use it as a return
> address (i.e., return to address 1). Address 1 is probably no valid
> address on your system, so you get an "invalid memory address" error.
>
> What did you want to achieve?
> - 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
wasn't it just pushing it to the return stack?

Re: error for no apparent reason gforth

<2022Jan27.141333@mips.complang.tuwien.ac.at>

  copy mid

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

  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: error for no apparent reason gforth
Date: Thu, 27 Jan 2022 13:13:33 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 52
Message-ID: <2022Jan27.141333@mips.complang.tuwien.ac.at>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com> <2022Jan27.094849@mips.complang.tuwien.ac.at> <ssu15f$78q$1@gioia.aioe.org>
Injection-Info: reader02.eternal-september.org; posting-host="df00b91258d925986056b62bd2d5bc82";
logging-data="14759"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Hk5YygYbE+Vn5EBKb4hTF"
Cancel-Lock: sha1:WBD7cmJu4wVJiWMe4N1XIKKncUM=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Thu, 27 Jan 2022 13:13 UTC

dxforth <dxforth@gmail.com> writes:
>On 27/01/2022 19:48, Anton Ertl wrote:
>>
>> *There is a relatively newfangled optimization in development Gforth
>> that compiles "0 +" into nothing, and as a result won't report a stack
>> underflow when that code is executed starting with an empty stack.
>
>gforth-fast 2020-07-09 does that. What cases prompted you to add it?
>I'm aware +FIELD optimizes the 0 offset case but that's handled separately (?)

In development Gforth +FIELD does not handle 0 separately, but leaves
it to the code generator OPT+- for + and - to handle the 0 case.
Handling it in OPT+- is just as much effort, but is more general.
Here's the code:

1) For the code generator for compiling a field, without special
handling of 0:

: field+, >body @ lit, postpone + ;

2) For OPT+-, with special handling of 0:

: opt+- {: xt: op -- :}
lits# 1 = if
0 lits> op ?dup-if
['] lit+ peephole-compile, , then
exit then
action-of op fold2-1 ;
' opt+- folds + -

The handling of 0 is the ?DUP-IF and its THEN. Leave these two words
away, and 0 + compiles to LIT+ with a 0 immediate operand.

Here's the explanation for the rest: OP is the word being compiled (+
or -). The first IF checks if there is exactly one literal on the
(literal) stack (for optimizing to use LIT+); if not, the general
constant folder fold2-1 for words with 2 cells input and one cell
output is used: if there are at least two operands it applies op to
compute a new literal, otherwise it just compiles the literals from
the literal stack (there can be none, given that we already filtered
out the 1-literal case earlier) and OP.

I don't think there were any cases that prompted us to go this way,
just the general principle of not unnecessarily restricting the scope
of dealing with 0.

- 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: error for no apparent reason gforth

<ssu7vh$1h9r$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Fri, 28 Jan 2022 00:50:40 +1100
Organization: Aioe.org NNTP Server
Message-ID: <ssu7vh$1h9r$1@gioia.aioe.org>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<sst9rt$lqn$1@gioia.aioe.org>
<cf55742b-e66b-4146-886f-24abf578b3ecn@googlegroups.com>
<2022Jan27.141033@mips.complang.tuwien.ac.at>
<85b92e1d-ada2-4a2b-921e-bbffaefdce49n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="50491"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Thu, 27 Jan 2022 13:50 UTC

On 28/01/2022 00:20, fabianor...@gmail.com wrote:
> Em quinta-feira, 27 de janeiro de 2022 às 10:13:20 UTC-3, Anton Ertl escreveu:
>> "fabianor...@gmail.com" <fabianor...@gmail.com> writes:
>> >: my-word >R ;
>> >1 my-word
>> >*the terminal*:21:7: error: invalid memory adress
>> This pushes 1 on the return stack and then tries to use it as a return
>> address (i.e., return to address 1). Address 1 is probably no valid
>> address on your system, so you get an "invalid memory address" error.
>>
>> What did you want to achieve?
>> - 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
> wasn't it just pushing it to the return stack?

Yes but the system is also using the return stack while you're typing!
The return stack is primarily for its use - not yours.

Re: error for no apparent reason gforth

<e0d41e4c-e66f-4e66-bad9-14c83afce3a6n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:a707:: with SMTP id q7mr2774707qke.229.1643295036533;
Thu, 27 Jan 2022 06:50:36 -0800 (PST)
X-Received: by 2002:a05:620a:254d:: with SMTP id s13mr2803245qko.110.1643295036384;
Thu, 27 Jan 2022 06:50:36 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Thu, 27 Jan 2022 06:50:36 -0800 (PST)
In-Reply-To: <ssu7vh$1h9r$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=168.121.177.102; posting-account=OMrK2AoAAACPu8JcOP64zhFwVmCz0fk3
NNTP-Posting-Host: 168.121.177.102
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<sst9rt$lqn$1@gioia.aioe.org> <cf55742b-e66b-4146-886f-24abf578b3ecn@googlegroups.com>
<2022Jan27.141033@mips.complang.tuwien.ac.at> <85b92e1d-ada2-4a2b-921e-bbffaefdce49n@googlegroups.com>
<ssu7vh$1h9r$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e0d41e4c-e66f-4e66-bad9-14c83afce3a6n@googlegroups.com>
Subject: Re: error for no apparent reason gforth
From: fabianor...@gmail.com (fabianor...@gmail.com)
Injection-Date: Thu, 27 Jan 2022 14:50:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 26
 by: fabianor...@gmail.co - Thu, 27 Jan 2022 14:50 UTC

Em quinta-feira, 27 de janeiro de 2022 às 10:50:45 UTC-3, dxforth escreveu:
> On 28/01/2022 00:20, fabianor...@gmail.com wrote:
> > Em quinta-feira, 27 de janeiro de 2022 às 10:13:20 UTC-3, Anton Ertl escreveu:
> >> "fabianor...@gmail.com" <fabianor...@gmail.com> writes:
> >> >: my-word >R ;
> >> >1 my-word
> >> >*the terminal*:21:7: error: invalid memory adress
> >> This pushes 1 on the return stack and then tries to use it as a return
> >> address (i.e., return to address 1). Address 1 is probably no valid
> >> address on your system, so you get an "invalid memory address" error.
> >>
> >> What did you want to achieve?
> >> - 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
> > wasn't it just pushing it to the return stack?
> Yes but the system is also using the return stack while you're typing!
> The return stack is primarily for its use - not yours.
Thanks

Re: error for no apparent reason gforth

<2022Jan27.181102@mips.complang.tuwien.ac.at>

  copy mid

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

  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: error for no apparent reason gforth
Date: Thu, 27 Jan 2022 17:11:02 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 23
Message-ID: <2022Jan27.181102@mips.complang.tuwien.ac.at>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com> <sst9rt$lqn$1@gioia.aioe.org> <cf55742b-e66b-4146-886f-24abf578b3ecn@googlegroups.com> <2022Jan27.141033@mips.complang.tuwien.ac.at> <85b92e1d-ada2-4a2b-921e-bbffaefdce49n@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="df00b91258d925986056b62bd2d5bc82";
logging-data="16937"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8F3XW8J+HYrWWvAHTGOQO"
Cancel-Lock: sha1:6fy10nDfh1BTkGuju7NRCDllR/I=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Thu, 27 Jan 2022 17:11 UTC

"fabianor...@gmail.com" <fabianorezende26@gmail.com> writes:
>Em quinta-feira, 27 de janeiro de 2022 =C3=A0s 10:13:20 UTC-3, Anton Ertl e=
>screveu:
>> "fabianor...@gmail.com" <fabianor...@gmail.com> writes:=20
>> >: my-word >R ;=20
>> >1 my-word=20
>> >*the terminal*:21:7: error: invalid memory adress
....
>wasn't it just pushing it to the return stack?

The call to MY-WORD pushes a return address (which points to somewhere
in the text interpreter in this case) on the return stack, then >R
pushes 1 on the return stack, then the return from MY-WORD should
happen (using the word ";S", which you see in the backtrace), but
instead of the return address it finds 1 on the return stack, and
tries to return there.

- 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: error for no apparent reason gforth

<ssutnq$51p$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: do-not-...@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Thu, 27 Jan 2022 20:02:03 +0000
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <ssutnq$51p$1@dont-email.me>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 27 Jan 2022 20:02:02 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="fa05338248e5ce8d0b97768b37e2d0b3";
logging-data="5177"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/e0ie5lOdkq6KDlpEt5jpM7LUdPSC2LXo="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Cancel-Lock: sha1:JBKC952JSL0/zhA8hd8fi3CaDCk=
In-Reply-To: <2022Jan27.094849@mips.complang.tuwien.ac.at>
 by: Gerry Jackson - Thu, 27 Jan 2022 20:02 UTC

On 27/01/2022 08:48, Anton Ertl wrote:
> For stack underflow, there is one generality I can state: gforth (the
> debugging engine) reports almost* every stack underflow, most other
> Forth systems (including gforth-fast) are less pedantic. E.g.,
> starting with an empty stack,
>
> 1 swap .
>
> does not report an error on gforth-fast, iforth, lxf, SwiftForth, or
> VFX, but reports a stack underflow in gforth.

--
Gerry

Re: error for no apparent reason gforth

<ssuvtb$l2s$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: do-not-...@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Thu, 27 Jan 2022 20:39:08 +0000
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <ssuvtb$l2s$1@dont-email.me>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 27 Jan 2022 20:39:07 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="fa05338248e5ce8d0b97768b37e2d0b3";
logging-data="21596"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zmtIgyknBroa6+GJHclnOF7pCjTKBqoQ="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Cancel-Lock: sha1:3w1iObZ5TTWewJpCT+txPV6rXw8=
In-Reply-To: <2022Jan27.094849@mips.complang.tuwien.ac.at>
 by: Gerry Jackson - Thu, 27 Jan 2022 20:39 UTC

On 27/01/2022 08:48, Anton Ertl wrote:
> For stack underflow, there is one generality I can state: gforth (the
> debugging engine) reports almost* every stack underflow, most other
> Forth systems (including gforth-fast) are less pedantic. E.g.,
> starting with an empty stack,
>
> 1 swap .
>
> does not report an error on gforth-fast, iforth, lxf, SwiftForth, or
> VFX, but reports a stack underflow in gforth.

My system doesn't report stack underflow for 1 SWAP and this triggered
me into investigating a bit further. 1 SWAP is actually safe for a small
underflow because there are a few guard cells below the stack so that
simple underflow doesn't cause a system crash. 1 SWAP actually works.
The integer swapped under the stack is actually accessible - I never
thought about this before.

e.g. (assume an empty stack)
1234 swap over . \ displays 1234
1 2 3 4 5 depth pick . \ displays 1234

Similarly with other stack manipulation words.

This is also the case with SwiftForth, VFX Forth, wf32 Forth.
Yet another way to misuse Forth!

This is potentially useful if you want to stash some data for re-entrant
code without having to maintain it near the top of the stack.

--
Gerry

Re: error for no apparent reason gforth

<cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:3192:: with SMTP id bi18mr4105433qkb.615.1643322595332;
Thu, 27 Jan 2022 14:29:55 -0800 (PST)
X-Received: by 2002:ac8:5317:: with SMTP id t23mr4343461qtn.508.1643322595031;
Thu, 27 Jan 2022 14:29:55 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Thu, 27 Jan 2022 14:29:54 -0800 (PST)
In-Reply-To: <ssuvtb$l2s$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=79.224.100.194; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 79.224.100.194
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com>
Subject: Re: error for no apparent reason gforth
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Thu, 27 Jan 2022 22:29:55 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 32
 by: minf...@arcor.de - Thu, 27 Jan 2022 22:29 UTC

Gerry Jackson schrieb am Donnerstag, 27. Januar 2022 um 21:39:10 UTC+1:
> On 27/01/2022 08:48, Anton Ertl wrote:
> > For stack underflow, there is one generality I can state: gforth (the
> > debugging engine) reports almost* every stack underflow, most other
> > Forth systems (including gforth-fast) are less pedantic. E.g.,
> > starting with an empty stack,
> >
> > 1 swap .
> >
> > does not report an error on gforth-fast, iforth, lxf, SwiftForth, or
> > VFX, but reports a stack underflow in gforth.
> My system doesn't report stack underflow for 1 SWAP and this triggered
> me into investigating a bit further. 1 SWAP is actually safe for a small
> underflow because there are a few guard cells below the stack so that
> simple underflow doesn't cause a system crash. 1 SWAP actually works.
> The integer swapped under the stack is actually accessible - I never
> thought about this before.
>
> e.g. (assume an empty stack)
> 1234 swap over . \ displays 1234
> 1 2 3 4 5 depth pick . \ displays 1234
>
> Similarly with other stack manipulation words.
>
> This is also the case with SwiftForth, VFX Forth, wf32 Forth.
> Yet another way to misuse Forth!
>
> This is potentially useful if you want to stash some data for re-entrant
> code without having to maintain it near the top of the stack.
>

I consider this array-out-of-bounds usage as poor and potentially dangerous practice.
Eg Java would throw a runtime exception.

Re: error for no apparent reason gforth

<ssvc31$ssl$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Fri, 28 Jan 2022 11:06:56 +1100
Organization: Aioe.org NNTP Server
Message-ID: <ssvc31$ssl$1@gioia.aioe.org>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
<cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="29589"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Fri, 28 Jan 2022 00:06 UTC

On 28/01/2022 09:29, minf...@arcor.de wrote:
> Gerry Jackson schrieb am Donnerstag, 27. Januar 2022 um 21:39:10 UTC+1:
>> On 27/01/2022 08:48, Anton Ertl wrote:
>> > For stack underflow, there is one generality I can state: gforth (the
>> > debugging engine) reports almost* every stack underflow, most other
>> > Forth systems (including gforth-fast) are less pedantic. E.g.,
>> > starting with an empty stack,
>> >
>> > 1 swap .
>> >
>> > does not report an error on gforth-fast, iforth, lxf, SwiftForth, or
>> > VFX, but reports a stack underflow in gforth.
>> My system doesn't report stack underflow for 1 SWAP and this triggered
>> me into investigating a bit further. 1 SWAP is actually safe for a small
>> underflow because there are a few guard cells below the stack so that
>> simple underflow doesn't cause a system crash. 1 SWAP actually works.
>> The integer swapped under the stack is actually accessible - I never
>> thought about this before.
>>
>> e.g. (assume an empty stack)
>> 1234 swap over . \ displays 1234
>> 1 2 3 4 5 depth pick . \ displays 1234
>>
>> Similarly with other stack manipulation words.
>>
>> This is also the case with SwiftForth, VFX Forth, wf32 Forth.
>> Yet another way to misuse Forth!
>>
>> This is potentially useful if you want to stash some data for re-entrant
>> code without having to maintain it near the top of the stack.
>>
>
> I consider this array-out-of-bounds usage as poor and potentially dangerous practice.
> Eg Java would throw a runtime exception.

It's exploiting system peculiarities. How dangerous depends on the user.

Stack out-of-bounds is murky. Consider a system with separate fp stack:

DX-Forth 4.45 2022-01-11
Software floating-point (separate stack)
Using FORTH.SCR

le ok
le ok
le ok
le ok
le ok
le ok
le
Error: "le" f-stack?

le ok
le ok
le ok
le ok
le ok
le ok
f. 1. ok

What's not apparent to the user is that F. itself used several stack positions
in the process of displaying 1. The 'trick' was allocating more fp stack than
what the user sees. The things we do to keep users (and ourselves) happy!

Re: error for no apparent reason gforth

<MPG.3c5dd9a948fc3534989721@news.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!J83X4gA4+scZkDaTv6hGGw.user.46.165.242.91.POSTED!not-for-mail
From: joh...@example.com (john)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Fri, 28 Jan 2022 10:45:39 -0000
Organization: Aioe.org NNTP Server
Message-ID: <MPG.3c5dd9a948fc3534989721@news.aioe.org>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com> <2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="2219"; posting-host="J83X4gA4+scZkDaTv6hGGw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: MicroPlanet-Gravity/3.0.4
X-Notice: Filtered by postfilter v. 0.9.2
 by: john - Fri, 28 Jan 2022 10:45 UTC

In article <ssuvtb$l2s$1@dont-email.me>, do-not-use@swldwa.uk says...
> This is potentially useful if you want to stash some data for re-entrant
> code without having to maintain it near the top of the stack.
>
> --
> Gerry
>
>

Or if you want to crash an aeroplane.

john

=========================
http://johntech.co.uk
=========================

Re: error for no apparent reason gforth

<MPG.3c5dda20dfcc8acc989722@news.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!J83X4gA4+scZkDaTv6hGGw.user.46.165.242.91.POSTED!not-for-mail
From: joh...@example.com (john)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Fri, 28 Jan 2022 10:47:30 -0000
Organization: Aioe.org NNTP Server
Message-ID: <MPG.3c5dda20dfcc8acc989722@news.aioe.org>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com> <2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me> <cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com> <ssvc31$ssl$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="2219"; posting-host="J83X4gA4+scZkDaTv6hGGw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: MicroPlanet-Gravity/3.0.4
X-Notice: Filtered by postfilter v. 0.9.2
 by: john - Fri, 28 Jan 2022 10:47 UTC

In article <ssvc31$ssl$1@gioia.aioe.org>, dxforth@gmail.com says...
> Stack out-of-bounds is murky.
>

No.
It is unaceptable.

john

=========================
http://johntech.co.uk
=========================

Re: error for no apparent reason gforth

<d9d2fe02-e772-4b67-9287-9a61a1b3b673n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:41c8:: with SMTP id o8mr5701249qtm.386.1643368628449;
Fri, 28 Jan 2022 03:17:08 -0800 (PST)
X-Received: by 2002:ac8:5a04:: with SMTP id n4mr5649801qta.38.1643368628289;
Fri, 28 Jan 2022 03:17:08 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Fri, 28 Jan 2022 03:17:08 -0800 (PST)
In-Reply-To: <ssvc31$ssl$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f16:6f99:b869:e40:2f34:7353;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f16:6f99:b869:e40:2f34:7353
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
<cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com> <ssvc31$ssl$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d9d2fe02-e772-4b67-9287-9a61a1b3b673n@googlegroups.com>
Subject: Re: error for no apparent reason gforth
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Fri, 28 Jan 2022 11:17:08 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 64
 by: minf...@arcor.de - Fri, 28 Jan 2022 11:17 UTC

dxforth schrieb am Freitag, 28. Januar 2022 um 01:06:59 UTC+1:
> On 28/01/2022 09:29, minf...@arcor.de wrote:
> > Gerry Jackson schrieb am Donnerstag, 27. Januar 2022 um 21:39:10 UTC+1:
> >> On 27/01/2022 08:48, Anton Ertl wrote:
> >> > For stack underflow, there is one generality I can state: gforth (the
> >> > debugging engine) reports almost* every stack underflow, most other
> >> > Forth systems (including gforth-fast) are less pedantic. E.g.,
> >> > starting with an empty stack,
> >> >
> >> > 1 swap .
> >> >
> >> > does not report an error on gforth-fast, iforth, lxf, SwiftForth, or
> >> > VFX, but reports a stack underflow in gforth.
> >> My system doesn't report stack underflow for 1 SWAP and this triggered
> >> me into investigating a bit further. 1 SWAP is actually safe for a small
> >> underflow because there are a few guard cells below the stack so that
> >> simple underflow doesn't cause a system crash. 1 SWAP actually works.
> >> The integer swapped under the stack is actually accessible - I never
> >> thought about this before.
> >>
> >> e.g. (assume an empty stack)
> >> 1234 swap over . \ displays 1234
> >> 1 2 3 4 5 depth pick . \ displays 1234
> >>
> >> Similarly with other stack manipulation words.
> >>
> >> This is also the case with SwiftForth, VFX Forth, wf32 Forth.
> >> Yet another way to misuse Forth!
> >>
> >> This is potentially useful if you want to stash some data for re-entrant
> >> code without having to maintain it near the top of the stack.
> >>
> >
> > I consider this array-out-of-bounds usage as poor and potentially dangerous practice.
> > Eg Java would throw a runtime exception.
> It's exploiting system peculiarities. How dangerous depends on the user.
>
> Stack out-of-bounds is murky. Consider a system with separate fp stack:
>
> DX-Forth 4.45 2022-01-11
> Software floating-point (separate stack)
> Using FORTH.SCR
>
> le ok
> le ok
> le ok
> le ok
> le ok
> le ok
> le
> Error: "le" f-stack?
>
> le ok
> le ok
> le ok
> le ok
> le ok
> le ok
> f. 1. ok
>
> What's not apparent to the user is that F. itself used several stack positions
> in the process of displaying 1. The 'trick' was allocating more fp stack than
> what the user sees. The things we do to keep users (and ourselves) happy!

Do you call THIS the Principle of Least Surprise? ;-)

Re: error for no apparent reason gforth

<2022Jan28.123641@mips.complang.tuwien.ac.at>

  copy mid

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

  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: error for no apparent reason gforth
Date: Fri, 28 Jan 2022 11:36:41 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 56
Message-ID: <2022Jan28.123641@mips.complang.tuwien.ac.at>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com> <2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="2564c2e7e7b021e3b688522e299eb7d6";
logging-data="4995"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18u5Sg/VpmzRX1bD1R51uej"
Cancel-Lock: sha1:3ZhdrnbE6MIG8iB5eUDzqy9oyRo=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Fri, 28 Jan 2022 11:36 UTC

Gerry Jackson <do-not-use@swldwa.uk> writes:
>The integer swapped under the stack is actually accessible - I never
>thought about this before.
>
>e.g. (assume an empty stack)
>1234 swap over . \ displays 1234
>1 2 3 4 5 depth pick . \ displays 1234
>
>Similarly with other stack manipulation words.
>
>This is also the case with SwiftForth, VFX Forth, wf32 Forth.
>Yet another way to misuse Forth!
>
>This is potentially useful if you want to stash some data for re-entrant
>code without having to maintain it near the top of the stack.

It won't work for recursive calls, therefore not for general
re-entrant code. It would have per-thread space for multi-threaded
code, but you can do the same with a user variable.

The other problem with the idea is that there is no good way to do the
stashing. You can get the value with "DEPTH PICK", but there is no
standard or at least common word for storing the value.

And if you really want to want to store at the bottom of the stack,
the (slightly) more portable approach is to store it in the bottom
element, not in the below-bottom element, e.g. (on SwiftForth):

987 1234 depth 1- -roll
1 2 3 4 5 depth 1- pick . \ prints 1234
..s \ prints 1234 987 1 2 3 4 5 <-Top

Given that the normal idiom in Forth is that words leave the stack
below their input parameters alone, storing one value in a program in
such a way should not interfere with normal code. Of course, in
general storing multiple values in this way does not work unless the
accesses to the two values follow some specific discipline; but that's
the same whether you stash in the bottom element or in the
below-bottom element. Actually, if you stash in the below-bottom
element with "PICK -ROLL", the previously stashed value becomes the
bottom element; if you stash with STICK, the previously stashed value
is overwritten.

But the major question is why you would want to stash a value there.
If you are in a word with stack effect ( a b c -- d e ), and you need
to stash a value away, why not just put it in the return stack, a
local, or the data stack at a position with at most the same depth as
a/d? That gives you true re-entrancy and more performance, and these
are probably the reason why these are the standard idioms in Forth.

- 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: error for no apparent reason gforth

<st0rav$121c$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Sat, 29 Jan 2022 00:33:18 +1100
Organization: Aioe.org NNTP Server
Message-ID: <st0rav$121c$1@gioia.aioe.org>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
<cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com>
<ssvc31$ssl$1@gioia.aioe.org>
<d9d2fe02-e772-4b67-9287-9a61a1b3b673n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="34860"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Fri, 28 Jan 2022 13:33 UTC

On 28/01/2022 22:17, minf...@arcor.de wrote:
> dxforth schrieb am Freitag, 28. Januar 2022 um 01:06:59 UTC+1:
>> On 28/01/2022 09:29, minf...@arcor.de wrote:
>> > Gerry Jackson schrieb am Donnerstag, 27. Januar 2022 um 21:39:10 UTC+1:
>> >> On 27/01/2022 08:48, Anton Ertl wrote:
>> >> > For stack underflow, there is one generality I can state: gforth (the
>> >> > debugging engine) reports almost* every stack underflow, most other
>> >> > Forth systems (including gforth-fast) are less pedantic. E.g.,
>> >> > starting with an empty stack,
>> >> >
>> >> > 1 swap .
>> >> >
>> >> > does not report an error on gforth-fast, iforth, lxf, SwiftForth, or
>> >> > VFX, but reports a stack underflow in gforth.
>> >> My system doesn't report stack underflow for 1 SWAP and this triggered
>> >> me into investigating a bit further. 1 SWAP is actually safe for a small
>> >> underflow because there are a few guard cells below the stack so that
>> >> simple underflow doesn't cause a system crash. 1 SWAP actually works.
>> >> The integer swapped under the stack is actually accessible - I never
>> >> thought about this before.
>> >>
>> >> e.g. (assume an empty stack)
>> >> 1234 swap over . \ displays 1234
>> >> 1 2 3 4 5 depth pick . \ displays 1234
>> >>
>> >> Similarly with other stack manipulation words.
>> >>
>> >> This is also the case with SwiftForth, VFX Forth, wf32 Forth.
>> >> Yet another way to misuse Forth!
>> >>
>> >> This is potentially useful if you want to stash some data for re-entrant
>> >> code without having to maintain it near the top of the stack.
>> >>
>> >
>> > I consider this array-out-of-bounds usage as poor and potentially dangerous practice.
>> > Eg Java would throw a runtime exception.
>> It's exploiting system peculiarities. How dangerous depends on the user.
>>
>> Stack out-of-bounds is murky. Consider a system with separate fp stack:
>>
>> DX-Forth 4.45 2022-01-11
>> Software floating-point (separate stack)
>> Using FORTH.SCR
>>
>> le ok
>> le ok
>> le ok
>> le ok
>> le ok
>> le ok
>> le
>> Error: "le" f-stack?
>>
>> le ok
>> le ok
>> le ok
>> le ok
>> le ok
>> le ok
>> f. 1. ok
>>
>> What's not apparent to the user is that F. itself used several stack positions
>> in the process of displaying 1. The 'trick' was allocating more fp stack than
>> what the user sees. The things we do to keep users (and ourselves) happy!
>
> Do you call THIS the Principle of Least Surprise? ;-)

What would you call it?

Re: error for no apparent reason gforth

<st1hng$aio$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: do-not-...@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Fri, 28 Jan 2022 19:55:29 +0000
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <st1hng$aio$1@dont-email.me>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
<cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 28 Jan 2022 19:55:28 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ca02484f8c9c4b281c800c8841cdfcef";
logging-data="10840"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VGGktZAvqvYKgezxKtDARgcYGBOKoXHA="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Cancel-Lock: sha1:p3o3rFJfKvkh0J5cHfx6K6ygdGU=
In-Reply-To: <cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com>
 by: Gerry Jackson - Fri, 28 Jan 2022 19:55 UTC

On 27/01/2022 22:29, minf...@arcor.de wrote:
> Gerry Jackson schrieb am Donnerstag, 27. Januar 2022 um 21:39:10 UTC+1:
>> On 27/01/2022 08:48, Anton Ertl wrote:
>>> For stack underflow, there is one generality I can state: gforth (the
>>> debugging engine) reports almost* every stack underflow, most other
>>> Forth systems (including gforth-fast) are less pedantic. E.g.,
>>> starting with an empty stack,
>>>
>>> 1 swap .
>>>
>>> does not report an error on gforth-fast, iforth, lxf, SwiftForth, or
>>> VFX, but reports a stack underflow in gforth.
>> My system doesn't report stack underflow for 1 SWAP and this triggered
>> me into investigating a bit further. 1 SWAP is actually safe for a small
>> underflow because there are a few guard cells below the stack so that
>> simple underflow doesn't cause a system crash. 1 SWAP actually works.
>> The integer swapped under the stack is actually accessible - I never
>> thought about this before.
>>
>> e.g. (assume an empty stack)
>> 1234 swap over . \ displays 1234
>> 1 2 3 4 5 depth pick . \ displays 1234
>>
>> Similarly with other stack manipulation words.
>>
>> This is also the case with SwiftForth, VFX Forth, wf32 Forth.
>> Yet another way to misuse Forth!
>>
>> This is potentially useful if you want to stash some data for re-entrant
>> code without having to maintain it near the top of the stack.
>>
>
> I consider this array-out-of-bounds usage as poor and potentially dangerous practice.
> Eg Java would throw a runtime exception.

I don't disagree, which is why I wrote 'way to misuse Forth', also it is
non-portable. But, acting as devil's advocate, and speaking for my
system only.

From the system's point of view such an access is not an
'array-out-of-bounds' access as it is still within the memory allocated
for the stack. So it is valid for such a system to use it (by the way my
system doesn't).

From the user's point of view it does appear to be out of bounds for a
standard program because the system makes only a part of the stack
directly visible to the user. But as long as the stack underflow is not
more than a few cells it's as safe as any other stack cell.

Of course other systems that I quoted where the simple accesses do
appear to work may be corrupting something that has no visible effect in
such simple non-standard examples.

--
Gerry

Re: error for no apparent reason gforth

<st1ljv$7hv$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!news.freedyn.de!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: do-not-...@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Fri, 28 Jan 2022 21:01:52 +0000
Organization: A noiseless patient Spider
Lines: 82
Message-ID: <st1ljv$7hv$1@dont-email.me>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
<2022Jan28.123641@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 28 Jan 2022 21:01:51 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ca02484f8c9c4b281c800c8841cdfcef";
logging-data="7743"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Eb5vHXTD8LE2u+FAUE+QK6zx4l+UqAYE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Cancel-Lock: sha1:8BmnmgNToxkFP1DN24+gpHkRvNs=
In-Reply-To: <2022Jan28.123641@mips.complang.tuwien.ac.at>
 by: Gerry Jackson - Fri, 28 Jan 2022 21:01 UTC

On 28/01/2022 11:36, Anton Ertl wrote:
> Gerry Jackson <do-not-use@swldwa.uk> writes:
>> The integer swapped under the stack is actually accessible - I never
>> thought about this before.
>>
>> e.g. (assume an empty stack)
>> 1234 swap over . \ displays 1234
>> 1 2 3 4 5 depth pick . \ displays 1234
>>
>> Similarly with other stack manipulation words.
>>
>> This is also the case with SwiftForth, VFX Forth, wf32 Forth.
>> Yet another way to misuse Forth!
>>
>> This is potentially useful if you want to stash some data for re-entrant
>> code without having to maintain it near the top of the stack.
>
> It won't work for recursive calls,

Why not? I would envisage it as constant during recursion when DEPTH
PICK will always retrieve it whatever the level of recursion. I wasn't
thinking of writing to it repeatedly.

> therefore not for general
> re-entrant code. It would have per-thread space for multi-threaded
> code, but you can do the same with a user variable.
>
> The other problem with the idea is that there is no good way to do the
> stashing. You can get the value with "DEPTH PICK", but there is no
> standard or at least common word for storing the value.

Given that we're talking about non-standard usage saying there's no
standard way to save it is a weak argument. A non standard way to save
it is a bit messy e.g. assuming the top of stack is to go there:
: bury >r depth roll drop r> depth -roll ;

But much simpler if there only 2 or fewer items on the stack

>
> And if you really want to want to store at the bottom of the stack,
> the (slightly) more portable approach is to store it in the bottom
> element, not in the below-bottom element, e.g. (on SwiftForth):
>
> 987 1234 depth 1- -roll
> 1 2 3 4 5 depth 1- pick . \ prints 1234
> .s \ prints 1234 987 1 2 3 4 5 <-Top
>

Yes I've been aware of that for many years.

> Given that the normal idiom in Forth is that words leave the stack
> below their input parameters alone, storing one value in a program in
> such a way should not interfere with normal code. Of course, in
> general storing multiple values in this way does not work unless the
> accesses to the two values follow some specific discipline; but that's
> the same whether you stash in the bottom element or in the
> below-bottom element. Actually, if you stash in the below-bottom
> element with "PICK -ROLL", the previously stashed value becomes the
> bottom element;

Yes that's obvious, see BURY above. Yes it would have to be used with
care, but that's true of normal stack operations anyway.

> if you stash with STICK, the previously stashed value
> is overwritten.
>
> But the major question is why you would want to stash a value there.

I don't want to, it was just your statement about stack underflow on
different systems that triggered me into wondering how systems behaved
and just pointing out some quirky behaviour.

> If you are in a word with stack effect ( a b c -- d e ), and you need
> to stash a value away, why not just put it in the return stack, a
> local, or the data stack at a position with at most the same depth as
> a/d? That gives you true re-entrancy and more performance, and these
> are probably the reason why these are the standard idioms in Forth.

When interpreting using the R stack and locals are non-standard.

--
Gerry

Re: error for no apparent reason gforth

<st20bi$g4m$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: error for no apparent reason gforth
Date: Sat, 29 Jan 2022 11:05:06 +1100
Organization: Aioe.org NNTP Server
Message-ID: <st20bi$g4m$1@gioia.aioe.org>
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
<cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com>
<st1hng$aio$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="16534"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Sat, 29 Jan 2022 00:05 UTC

On 29/01/2022 06:55, Gerry Jackson wrote:
> ...
> Of course other systems that I quoted where the simple accesses do
> appear to work may be corrupting something that has no visible effect in
> such simple non-standard examples.

Ideally a system would be designed such that even if a user makes a
simple stack error it won't trash the system. Fine if the system/OS
can sense under/overflow before it happens but least harm done if it
can't.

Re: error for no apparent reason gforth

<2b070bf5-9c26-4b34-b83e-2c1b0e4a67cdn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4515:: with SMTP id t21mr7864415qkp.525.1643444592199;
Sat, 29 Jan 2022 00:23:12 -0800 (PST)
X-Received: by 2002:a05:620a:4084:: with SMTP id f4mr6973630qko.327.1643444592003;
Sat, 29 Jan 2022 00:23:12 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Sat, 29 Jan 2022 00:23:11 -0800 (PST)
In-Reply-To: <st20bi$g4m$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f16:6fc2:8199:9d2a:1039:74bf;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f16:6fc2:8199:9d2a:1039:74bf
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
<cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com> <st1hng$aio$1@dont-email.me>
<st20bi$g4m$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2b070bf5-9c26-4b34-b83e-2c1b0e4a67cdn@googlegroups.com>
Subject: Re: error for no apparent reason gforth
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Sat, 29 Jan 2022 08:23:12 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 20
 by: minf...@arcor.de - Sat, 29 Jan 2022 08:23 UTC

dxforth schrieb am Samstag, 29. Januar 2022 um 01:05:11 UTC+1:
> On 29/01/2022 06:55, Gerry Jackson wrote:
> > ...
> > Of course other systems that I quoted where the simple accesses do
> > appear to work may be corrupting something that has no visible effect in
> > such simple non-standard examples.
> Ideally a system would be designed such that even if a user makes a
> simple stack error it won't trash the system. Fine if the system/OS
> can sense under/overflow before it happens but least harm done if it
> can't.

Ideally user errors like stack underflow should throw an exception _without_
crashing the system.

Perhaps system words should use their own stacks/registers without
affecting user stacks at all ...

It is a bit diametricical to the prevailing Forth "philosophy" of sacrificing
safety for speed.

Re: error for no apparent reason gforth

<9576c133-493b-4aa1-a65d-aff2b0668f52n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4151:: with SMTP id k17mr8207510qko.494.1643455252918;
Sat, 29 Jan 2022 03:20:52 -0800 (PST)
X-Received: by 2002:a05:622a:388:: with SMTP id j8mr8835405qtx.535.1643455252773;
Sat, 29 Jan 2022 03:20:52 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Sat, 29 Jan 2022 03:20:52 -0800 (PST)
In-Reply-To: <2b070bf5-9c26-4b34-b83e-2c1b0e4a67cdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:14ec:27af:b5f7:2603;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:14ec:27af:b5f7:2603
References: <184d658f-dde5-4b94-b79e-0bdf0d9dd58dn@googlegroups.com>
<2022Jan27.094849@mips.complang.tuwien.ac.at> <ssuvtb$l2s$1@dont-email.me>
<cae64ab0-787a-49ef-a77a-2f4538dadde9n@googlegroups.com> <st1hng$aio$1@dont-email.me>
<st20bi$g4m$1@gioia.aioe.org> <2b070bf5-9c26-4b34-b83e-2c1b0e4a67cdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9576c133-493b-4aa1-a65d-aff2b0668f52n@googlegroups.com>
Subject: Re: error for no apparent reason gforth
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Sat, 29 Jan 2022 11:20:52 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 35
 by: Marcel Hendrix - Sat, 29 Jan 2022 11:20 UTC

On Saturday, January 29, 2022 at 9:23:13 AM UTC+1, minf...@arcor.de wrote:
> dxforth schrieb am Samstag, 29. Januar 2022 um 01:05:11 UTC+1:
> > On 29/01/2022 06:55, Gerry Jackson wrote:
> > > ...
> > > Of course other systems that I quoted where the simple accesses do
> > > appear to work may be corrupting something that has no visible effect in
> > > such simple non-standard examples.
> > Ideally a system would be designed such that even if a user makes a
> > simple stack error it won't trash the system. Fine if the system/OS
> > can sense under/overflow before it happens but least harm done if it
> > can't.
> Ideally user errors like stack underflow should throw an exception _without_
> crashing the system.
>
> Perhaps system words should use their own stacks/registers without
> affecting user stacks at all ...
>
> It is a bit diametricical to the prevailing Forth "philosophy" of sacrificing
> safety for speed.

I seldomly see stack errors in code once it is debugged. There might be
unchecked code paths for situations that I initially thought extremely
unlikely.

What I notice in my own code is lots of errors with illegal memory access.
The reason it appears so frequenly is that I know that this type of error
is almost perfectly caught by the system and is very easy to correct,
so I just run the word without carefully desk-checking that portion of
the code.

The same happens when I program in C, I tend to run code with
complicated macros and library calls without carefully looking
up the documentation and have the debugger disassemble or
untangle the confusing parts :--)

-marcel

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor