,---------------. | Contributions | `---------------´ ,------------------------------------------ | 2023-12-20 06:09:31 lmr wrote: | requestClarification - NAMETO, NAMETO would allow programming the behavior of TO explicitly, both for the user and when implementing the kernel. ,---------. | Replies | `---------´ ,------------------------------------------ | 2023-12-20 07:41:02 AntonErtl replies: | requestClarification - Negative n values | see: https://forth-standard.org/standard/search/SET-ORDER#reply-1144 `------------------------------------------ It's not specified, so systems can do whatever they want. Giving it some sane behaviour, as you suggest, appears to be a good idea. Checking three systems, I see * gforth 0.7.3 does not produce an error, but the resulting search order does not include `order` or `set-order` (and is probably corrupt, word completion produces an "invalid memory address" throw). * SwiftForth 4.0.0-RC52 exits with a Segmentation fault. * VFX Forth 64 5.11 RC2 appears to handle -2 set-order in the same way as -1 set-order. ,------------------------------------------ | 2023-12-20 08:23:31 AntonErtl replies: | requestClarification - NAMETO, NAME`](https://gforth.org/manual/CREATE_002e_002eDOES_003e-details.html) ( xt -- ), which changes the most recent definition like `DOES>` does. * [`DEFINER!`](https://gforth.org/manual/Threading-Words.html) ( definer xt -- ), but it is obsolete (will be removed in a future version of Gforth); it goes with `>DEFINER` ( xt -- definer ) for getting a definer. * [`SET-TO`](https://gforth.org/manual/User_002ddefined-TO-and-DEFER_0040.html) ( xt -- ), but it takes the xt of a to-table that you have to define with `TO-TABLE:` (for also supporting `+TO` etc.). These words are still under discussion among Gforth developers. You can make a definition "most recent" with [`MAKE-LATEST`](https://gforth.org/manual/Making-a-word-current.html), but note that if you change a definition after it has already been used, the behaviour coming out of earlier uses may or may not change. For the thinking behind these words, you may want to read [The new Gforth Header](http://www.euroforth.org/ef19/papers/paysan.pdf) and/or watch the [video](https://wiki.forth-ev.de/doku.php/events:ef2019:header). VFX has a word for defining the interpretation semantics, but AFAIK not for TO. For other Forth systems I am not aware that they have words for this kind of stuff, and it probably requires significant changes to add something like `SET-TO` (probably in VFX, too). ,------------------------------------------ | 2023-12-20 10:34:25 lmr replies: | requestClarification - NAMETO, NAMETO ( nt -- to-xt ) \ implementation-specific \ NAMETO \ ( nt to-xt -- ) STATE @ IF SWAP POSTPONE LITERAL COMPILE, ELSE EXECUTE THEN ; IMMEDIATE : do_to_value ( x nt -- ) NAME>INTERPRET >BODY ! ; : VALUE >IN @ PARSE-NAME 2>R >IN ! CREATE , ['] do_to_value 2R> FIND-NAME NAME @ ; ``` (sorry for spamming an unrelated word... this should have been in the comment section for TO, but I don't know how to move it)