Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #131619
| From | Ruvim <ruvim.pinka@gmail.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: 0 SET-ORDER why? |
| Date | 2024-06-26 17:36 +0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <v5h5h6$2565d$1@dont-email.me> (permalink) |
| References | <v5fjkr$1p13i$1@dont-email.me> <2024Jun26.094910@mips.complang.tuwien.ac.at> <667bd654$1@news.ausics.net> |
On 2024-06-26 12:50, dxf wrote:
> On 26/06/2024 5:49 pm, Anton Ertl wrote:
>> Krishna Myneni <krishna.myneni@ccreweb.org> writes:
>>> Why is 0 a valid argument to SET-ORDER (from the optional Search-Order
>>> word set)? It can leave a Forth system in a non-recoverable state.
>>
>> So what? There are lots of ways to put a Forth system in a
>> non-recoverable state.
>>
>>> Sentences are separated for emphasis: "If n is zero, empty the search
>>> order." Why?
>>
>> Why not? It's what I would expect from 0 SET-ORDER anyway.
>>
>> Is your question: "What potential uses does an empty search order
>> have?" ?
>>
>> I have seen postings that suggest to use EVALUATE for converting
>> untrusted input into a number. There is of course no security
>> precautions in these postings, but at the very least one could empty
>> the search order before the EVALUATE and restore it after the EVALUATE
>> (with the EVALUATE being wrapped with CATCH). I thought about writing
>> out the source code, but the main things that would demonstrate is how
>> inconvenient GET-ORDER and SET-ORDER with their arbitrary number of
>> stack items are, and how inconvenient the arbitrary number of stack
>> items produced by EVALUATE is.
>>
>> Of course, with recognizer sequences, the better way is to use a
>> recognizer sequence that only contains the number recognizers you
>> want, no need to mess with the search order.
>>
>>> In kForth (32/64), the sequence
>>>
>>> 0 SET-ORDER
>>>
>>> leaves the Forth system in a non-recoverable state, and I have to use
>>> Ctrl-C to break out back to the OS shell. This appears to be true in
>>> Gforth as well, although Gforth traps Ctrl-C, so maybe one has to kill
>>> the process from another shell.
>>
>> In Gforth you can leave the text interpreter in the traditional Unix
>> way of doing Ctrl-D at the start of a line.
>>
>> Restoring an empty search order to some more usable default by the
>> system CATCH handler would be a potential convenience feature, but I
>> have not experienced an empty search order as a problem yet, and I
>> don't remember users asking for such a feature, either. And it would
>> only catch
>>
>> 0 SET-ORDER
>>
>> but not the functionally equivalent
>>
>> WORDLIST 1 SET-ORDER
>>
>> So why nerf one and not the other?
>
> So after all that you don't have an explanation either? You implemented
> it as instructed in the event someone finds a use.
I think, in this case it's better to specify behavior than to declare an
ambiguous condition.
Then the empty search order is the expected result by *induction*. It
would be strange to specify any other behavior in this case.
One possible use case:
: turnkey ( -- ) 0 set-order
also Target definitions
also Minimal also
;
It's found in
<https://github.com/eswartz/emul/blob/master/v9t9/v9t9-c/tools/Forth/site-forth/cross.fs>
Another possible use case:
: s-to-n ( addr u -- n )
depth >r
get-order n>r 0 set-order
['] evaluate ['] execute-interpreting catch
nr> set-order
depth 1- r> <> if -12 throw then
;
Where:
: compilation ( -- flag ) state @ 0<> ;
: enter-compilation ( -- ) ] ;
: leave-compilation ( -- ) postpone [ ;
: execute-interpreting ( i*x xt -- j*x )
compilation 0= if execute exit then
leave-compilation execute enter-compilation
;
: execute-compiling ( i*x xt -- j*x )
compilation if execute exit then
enter-compilation execute leave-compilation
;
BTW, I just realized that the words "execute-interpreting"
and "execute-compiling" are similar to well known word
"execute-parsing".
--
Ruvim
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-25 18:25 -0500
Re: 0 SET-ORDER why? minforth@gmx.net (minforth) - 2024-06-26 01:19 +0000
Re: 0 SET-ORDER why? albert@spenarnc.xs4all.nl - 2024-06-26 11:12 +0200
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-26 05:54 -0500
Re: 0 SET-ORDER why? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2024-06-26 07:49 +0000
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-06-26 18:50 +1000
Re: 0 SET-ORDER why? Ruvim <ruvim.pinka@gmail.com> - 2024-06-26 17:36 +0400
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-06-27 13:19 +1000
Re: 0 SET-ORDER why? Gerry Jackson <do-not-use@swldwa.uk> - 2024-06-27 23:10 +0100
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-06-28 11:56 +1000
Re: 0 SET-ORDER why? Ruvim <ruvim.pinka@gmail.com> - 2024-06-28 13:51 +0400
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-06-28 22:19 +1000
Re: 0 SET-ORDER why? Ruvim <ruvim.pinka@gmail.com> - 2024-06-28 17:48 +0400
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-06-29 03:08 +1000
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-07-01 18:45 +1000
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-06-29 13:27 +1000
Re: 0 SET-ORDER why? Gerry Jackson <do-not-use@swldwa.uk> - 2024-06-27 05:14 +0100
Re: 0 SET-ORDER why? albert@spenarnc.xs4all.nl - 2024-06-27 11:05 +0200
Re: 0 SET-ORDER why? minforth@gmx.net (minforth) - 2024-06-27 13:00 +0000
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-06-27 22:41 +1000
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-27 14:09 -0500
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-27 14:22 -0500
Re: 0 SET-ORDER why? Gerry Jackson <do-not-use@swldwa.uk> - 2024-06-27 23:08 +0100
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-27 18:44 -0500
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-06-28 15:51 +1000
Re: 0 SET-ORDER why? albert@spenarnc.xs4all.nl - 2024-06-28 10:04 +0200
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-29 09:09 -0500
Re: 0 SET-ORDER why? albert@spenarnc.xs4all.nl - 2024-06-30 12:22 +0200
Re: 0 SET-ORDER why? Ruvim <ruvim.pinka@gmail.com> - 2024-06-28 14:20 +0400
Re: 0 SET-ORDER why? albert@spenarnc.xs4all.nl - 2024-06-28 21:45 +0200
Recognizer protocol (was: 0 SET-ORDER why?) Ruvim <ruvim.pinka@gmail.com> - 2024-06-29 02:27 +0400
Re: 0 SET-ORDER why? Gerry Jackson <do-not-use@swldwa.uk> - 2024-07-04 07:26 +0100
Re: 0 SET-ORDER why? albert@spenarnc.xs4all.nl - 2024-06-26 11:18 +0200
Re: 0 SET-ORDER why? minforth@gmx.net (minforth) - 2024-06-26 10:36 +0000
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-26 06:13 -0500
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-26 05:56 -0500
Re: 0 SET-ORDER why? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2024-06-28 15:50 +0000
Re: 0 SET-ORDER why? Hans Bezemer <the.beez.speaks@gmail.com> - 2024-06-28 18:39 +0200
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-29 09:17 -0500
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-06-30 12:21 +1000
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-30 11:10 -0500
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-30 11:16 -0500
Re: 0 SET-ORDER why? minforth@gmx.net (minforth) - 2024-06-30 17:38 +0000
Re: 0 SET-ORDER why? albert@spenarnc.xs4all.nl - 2024-06-30 20:25 +0200
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-30 13:31 -0500
Re: 0 SET-ORDER why? minforth@gmx.net (minforth) - 2024-06-30 20:37 +0000
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-06-30 20:49 -0500
Re: 0 SET-ORDER why? mhx@iae.nl (mhx) - 2024-07-01 07:06 +0000
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-07-01 05:06 -0500
Re: 0 SET-ORDER why? albert@spenarnc.xs4all.nl - 2024-07-01 13:35 +0200
Re: 0 SET-ORDER why? Ruvim <ruvim.pinka@gmail.com> - 2024-07-01 13:02 +0400
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-07-01 05:13 -0500
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-07-01 21:02 +1000
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-07-02 15:56 +1000
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-07-02 20:04 -0500
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-07-03 12:32 +1000
Re: 0 SET-ORDER why? albert@spenarnc.xs4all.nl - 2024-07-03 11:59 +0200
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-07-04 00:46 +1000
Re: 0 SET-ORDER why? albert@spenarnc.xs4all.nl - 2024-07-01 13:39 +0200
Re: 0 SET-ORDER why? sjack@dontemail.me (sjack) - 2024-07-02 14:29 +0000
Re: 0 SET-ORDER why? dxf <dxforth@gmail.com> - 2024-07-03 00:52 +1000
Re: 0 SET-ORDER why? Ruvim <ruvim.pinka@gmail.com> - 2024-07-02 17:42 +0400
Re: 0 SET-ORDER why? Krishna Myneni <krishna.myneni@ccreweb.org> - 2024-07-02 20:17 -0500
Re: 0 SET-ORDER why? Anthony Howe <achowe@snert.com> - 2024-09-21 15:37 -0400
Re: 0 SET-ORDER why? Ruvim <ruvim.pinka@gmail.com> - 2024-09-22 21:52 +0400
Re: 0 SET-ORDER why? Anthony Howe <achowe@snert.com> - 2024-09-22 14:02 -0400
Re: 0 SET-ORDER why? Ruvim <ruvim.pinka@gmail.com> - 2024-09-23 00:21 +0400
csiph-web