I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is >empty, then return 0, otherwise return the name token nt for the
definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most
recently into the compilation word list, if such definition exists.
Otherwise throw exception code -80.
Feedback is welcome!
[1] >https://forth-standard.org/proposals/new-words-latest-name-and-latest-name-in?hideDiff#reply-1124
Ruvim
In article <uh5vno$36el4$1@dont-email.me>,
Ruvim <ruvim.pinka@gmail.com> wrote:
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is
empty, then return 0, otherwise return the name token nt for the
definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most
recently into the compilation word list, if such definition exists.
Otherwise throw exception code -80.
Feedback is welcome!
I hate to see NAME here. I advocate dea (dictionary entry address)
since 1993 , working on the transputer Forth with Marcel Hendrix.
There were N fields and N^2 transformation and I have had
enough of it.
***********************************************************
* Names are SO not determining the identity of a word. * ***********************************************************
I'm not against your proposal, only the names are wrong.
>LATEST ( wid -- dea|0 )
LATEST ( -- dea )
[1]
https://forth-standard.org/proposals/new-words-latest-name-and-latest-name-in?hideDiff#reply-1124
Ruvim
Groetjes Albert
P.S. I use LATEST all over the place. I have a hard time to imagine
a use for >LATEST. Unless ..
Only define >LATEST. LATEST might be controversial so you avoid
standardising it.
On the top of the file you then can say
: LATEST CURRENT @ >LATEST ;
And get it over with.
Same situation as with
: NOT 0= ;
"NAME" has a long history. It denoted NFA, and now it denotes a name------------------------
token, which is successor of NFA — in all words except
"PARSE-NAME", for example "FIND-NAME", "FIND-NAME-IN", "NAME>COMPILE", etc.
Why in heavens name, call it PARSE-NAME ?
On Monday, October 23, 2023 at 5:37:30 PM UTC+2, Ruvim wrote:
[..]
"NAME" has a long history. It denoted NFA, and now it denotes a name------------------------
token, which is successor of NFA — in all words except
"PARSE-NAME", for example "FIND-NAME", "FIND-NAME-IN", "NAME>COMPILE", etc.
Why in heavens name, call it PARSE-NAME ?
PARSE-NAME CORE EXT
( <spaces>name<space> -- c-addr u )
Skip leading space delimiters. Parse name delimited by a space.
c-addr is the address of the selected string within the input buffer
and u is its length in characters. If the parse area is empty or contains
only white space, the resulting string has length zero.
Apart from the above, it makes no sense and is counter-intuitive?
-marcel
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is empty, then return 0, otherwise return the name token nt for the
definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most
recently into the compilation word list, if such definition exists.
Otherwise throw exception code -80.
Feedback is welcome!
Ruvim schrieb am Montag, 23. Oktober 2023 um 16:25:00 UTC+2:
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is
empty, then return 0, otherwise return the name token nt for the
definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most
recently into the compilation word list, if such definition exists.
Otherwise throw exception code -80.
Feedback is welcome!
I fail to see a use case.
IMO the inner mechanisms of compilers shouldn't be cemented
by so-called standards.
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is empty, then return 0, otherwise return the name token nt for the definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most recently into the compilation word list, if such definition exists. Otherwise throw exception code -80.
Feedback is welcome!
On 2023-10-23 20:03, minforth wrote:
Ruvim schrieb am Montag, 23. Oktober 2023 um 16:25:00 UTC+2:
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is >> empty, then return 0, otherwise return the name token nt for the
definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most
recently into the compilation word list, if such definition exists.
Otherwise throw exception code -80.
Feedback is welcome!
I fail to see a use case.In the section "Typical use" (by the link), two use case examples are shown.
IMO the inner mechanisms of compilers shouldn't be cementedThe proposed API cements exactly zero inner mechanisms of compilers.
by so-called standards.
The only additional burden is to store the latest word in the word list structure. But anyway, almost all Forth systems do it. If not — the
system is free to not provide this API.
On 24/10/2023 1:24 am, Ruvim wrote:
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is empty, then return 0, otherwise return the name token nt for the definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most recently into the compilation word list, if such definition exists. Otherwise throw exception code -80.
Feedback is welcome!
Why the exception on LATEST-NAME - how many forths do that?
Ruvim schrieb am Montag, 23. Oktober 2023 um 16:25:00 UTC+2:
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is
empty, then return 0, otherwise return the name token nt for the
definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most
recently into the compilation word list, if such definition exists.
Otherwise throw exception code -80.
Feedback is welcome!
I fail to see a use case.
IMO the inner mechanisms of compilers shouldn't be cemented
by so-called standards.
On 2023-10-23 15:04, albert wrote:
In article <uh5vno$36el4$1@dont-email.me>,
Ruvim <ruvim.pinka@gmail.com> wrote:
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is >>> empty, then return 0, otherwise return the name token nt for the
definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most
recently into the compilation word list, if such definition exists.
Otherwise throw exception code -80.
Feedback is welcome!
I hate to see NAME here. I advocate dea (dictionary entry address)
since 1993 , working on the transputer Forth with Marcel Hendrix.
There were N fields and N^2 transformation and I have had
enough of it.
"DEA" is an acronym. It's better to use a full English word if appropriate.
"NAME" has a long history. It denoted NFA, and now it denotes a nameThat is a non sequitur. In particular FIND-NAME is an example why
token, which is successor of NFA — in all words except "PARSE-NAME", for >example "FIND-NAME", "FIND-NAME-IN", "NAME>COMPILE", etc.
There is no point in replacing "NAME" in all these words.
At the same time, naming for new words must be in consistence with
existing words.
[...]
***********************************************************
* Names are SO not determining the identity of a word. *
***********************************************************
I'm not against your proposal, only the names are wrong.
>LATEST ( wid -- dea|0 )
LATEST ( -- dea )
The first name is not consistent with other similar names.
And words with the second name already exist in many Forth systems, and
they behavior varies.
[1]
https://forth-standard.org/proposals/new-words-latest-name-and-latest-name-in?hideDiff#reply-1124
Ruvim
Groetjes Albert
P.S. I use LATEST all over the place. I have a hard time to imagine
a use for >LATEST. Unless ..
Only define >LATEST. LATEST might be controversial so you avoid
standardising it.
On the top of the file you then can say
: LATEST CURRENT @ >LATEST ;
It's will be slightly longer.
In my proposal this word never returns 0, but throws an exception instead.
And get it over with.
Same situation as with
: NOT 0= ;
--
Ruvim
A decorator example:
: [!] ( "name" -- )
latest-name dup >r
name>string ['] : execute-parsing
r> name> ' execute
postpone ;
;
: make-pretty ( xt -- )
[: ." (I got decorated)" ;] compile, compile,
;
: foo ." (I'm ordinary)" ;
[!] make-pretty
foo \ "(I got decorated)(I'm ordinary)"
--
Ruvim
On 24/10/2023 2:51 pm, dxf wrote:
On 24/10/2023 1:24 am, Ruvim wrote:
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is empty, then return 0, otherwise return the name token nt for the definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most recently into the compilation word list, if such definition exists. Otherwise throw exception code -80.
Feedback is welcome!
Why the exception on LATEST-NAME - how many forths do that?
Never mind - I've since seen the reference implementation on forth-standard.org.
Ruvim schrieb am Montag, 23. Oktober 2023 um 22:49:04 UTC+2:
On 2023-10-23 20:03, minforth wrote:
Ruvim schrieb am Montag, 23. Oktober 2023 um 16:25:00 UTC+2:In the section "Typical use" (by the link), two use case examples are shown.
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is >>>> empty, then return 0, otherwise return the name token nt for the
definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most
recently into the compilation word list, if such definition exists.
Otherwise throw exception code -80.
Feedback is welcome!
I fail to see a use case.
Those are examples for compiler extensions.
IMO the inner mechanisms of compilers shouldn't be cementedThe proposed API cements exactly zero inner mechanisms of compilers.
by so-called standards.
I don't think so. Many Forths have LAST which isn't standardized either.
The only additional burden is to store the latest word in the word list
structure. But anyway, almost all Forth systems do it. If not — the
system is free to not provide this API.
Perhaps a new wordset COMPILER-EXTENSION would be better.
Also as a good place for recognizers, whenever that proposal makes it.
In article <uh6m7s$3cc1o$1@dont-email.me>,
Ruvim <ruvim.pinka@gmail.com> wrote:
<SNIP>
A decorator example:
: [!] ( "name" -- )
latest-name dup >r
name>string ['] : execute-parsing
r> name> ' execute
postpone ;
;
: make-pretty ( xt -- )
[: ." (I got decorated)" ;] compile, compile,
;
: foo ." (I'm ordinary)" ;
[!] make-pretty
foo \ "(I got decorated)(I'm ordinary)"
In ciforth (leaving out the OK's)
WANT decorated {
: foo "(I'm ordinary)" TYPE ;
{ "(I got decorated)" TYPE } 'foo decorated
foo
(I got decorated)(I'm ordinary)
'foo undecorated
foo
(I'm ordinary)
The use case of `decorated is to add temporary debug
information to a complicated system, especially if
Heisenbugs prevent you to insert debugging code.
An example of a recent use in a Make Another Lisp project.
{ DUP EMIT CO DUP DUP SIZE TYPE &| EMIT } '$C+a decorated
$C+a appends a character to an ALLOCATEd string
What is after CO (Chuck Moores name is ;: ) is code
that is executed after the word decorated executes.
An example of output would be
AanothernameA|
confirming that the character is properly appended to the
ALLOCATE string, that was formerly apparently "anothername".
You can use the clunky :NONAME for { and ; for }
but the following won't fly.
: doit { "(I got decorated)" TYPE } 'foo decorated ;
doit
The use case of `decorated is to add temporary debug
information to a complicated system, especially if
Heisenbugs prevent you to insert debugging code.
The idea of a special syntax for decoration is that you don't need to
repeat the name of the word that is decorated.
Otherwise it's just a wrapper, which can be always implemented directly.
But your implementation is too system specific — it requires a
capability to change behavior of any word.
--
Ruvim
On 2023-10-24 06:49, minforth wrote:
Perhaps a new wordset COMPILER-EXTENSION would be better.
Also as a good place for recognizers, whenever that proposal makes it.
It's true for recognizers, since a program can affect the behavior of
the Forth text interpreter via Recognizer API (and even use it for its
own purposes).
But the words LATEST-NAME-IN and LATEST-NAME simply provide some
information from word lists, like the words FIND-NAME-IN or
TRAVERSE-WORDLIST do.
It bears repeating:
***********************************************************
* Names are SO not determining the identity of a word. *
***********************************************************
I agree. A word name does not identify the word.
A name token identifies the word, by its definition:
A name token is a single-cell value that identifies a named Forth
definition.
I can't getting the point accross.
The problem with LATEST that the obvious solution doesn't work.
The naive solution reading iso93 is returning an xt.
So what thingy is LATEST to return?
Sorry, I'm not following you here. I don't see how your question about >LATEST is related to my proposal.
Ruvim
In article <uh63vl$37cua$1@dont-email.me>,
Ruvim <ruvim.pinka@gmail.com> wrote:
On 2023-10-23 15:04, albert wrote:
In article <uh5vno$36el4$1@dont-email.me>,
Ruvim <ruvim.pinka@gmail.com> wrote:
I prepared a proposal: New words: latest-name and latest-name-in [1]
In a nutshell:
LATEST-NAME-IN ( wid -- nt|0 )
Remove the word list identifier wid from the stack. If this word list is >>>> empty, then return 0, otherwise return the name token nt for the
definition that was placed most recently into this word list.
LATEST-NAME ( -- nt )
Return the name token nt for the definition that was placed most
recently into the compilation word list, if such definition exists.
Otherwise throw exception code -80.
Feedback is welcome!
I hate to see NAME here. I advocate dea (dictionary entry address)
since 1993 , working on the transputer Forth with Marcel Hendrix.
There were N fields and N^2 transformation and I have had
enough of it.
"DEA" is an acronym. It's better to use a full English word if appropriate.
This a slight disadvantage. However it conflicts with nothing.
There are Forth names that are abbreviations:
R/O R/W SCR TIB SM/REM UM/MOD
In the 30 years I have used DEA nobody has come up that catches the
concept properly, and certainly anybody who has come up with a name that catches the concept improperly have found that is subject to confusion and infighting. On the other hand *nobody* has used "dea" in a conflicting
way.
"
The DEA of a word identifies the word internally. It should be
possible for the system to find all the properies of word
knowing its DEA. In particular the executable code and its
name (if it has a name)
" ^^^^^^^^^^^^^^^^
It bears repeating:
***********************************************************
* Names are SO not determining the identity of a word. *
***********************************************************
That is a non sequitur. In particular FIND-NAME is an example why
"NAME" has a long history. It denoted NFA, and now it denotes a name
token, which is successor of NFA — in all words except "PARSE-NAME", for >> example "FIND-NAME", "FIND-NAME-IN", "NAME>COMPILE", etc.
There is no point in replacing "NAME" in all these words.
At the same time, naming for new words must be in consistence with
existing words.
the string NAME is a separate concept of the dea.
Compare :
FOUND ( sc -- dea )
Look up the sc (addr len) in the current search order.
Return *the* address dea, the address that rules them all.
[...]
***********************************************************
* Names are SO not determining the identity of a word. *
***********************************************************
I'm not against your proposal, only the names are wrong.
>LATEST ( wid -- dea|0 )
LATEST ( -- dea )
The first name is not consistent with other similar names.
And words with the second name already exist in many Forth systems, and
they behavior varies.
Seriously? What with S>D >R U> EKEY>CHAR
You are trying to win a debate here at any price. That doesnot get you
points in a standard commission that must compromise.
It is not a fraternety debate club.
[1]
https://forth-standard.org/proposals/new-words-latest-name-and-latest-name-in?hideDiff#reply-1124
Ruvim
Groetjes Albert
P.S. I use LATEST all over the place. I have a hard time to imagine
a use for >LATEST. Unless ..
Only define >LATEST. LATEST might be controversial so you avoid
standardising it.
On the top of the file you then can say
: LATEST CURRENT @ >LATEST ;
It's will be slightly longer.
In my proposal this word never returns 0, but throws an exception instead. >>
And get it over with.
Same situation as with
: NOT 0= ;
I can't getting the point accross.
The problem with LATEST that the obvious solution doesn't work.
The naive solution reading iso93 is returning an xt.
So what thingy is LATEST to return?
Ruvim schrieb am Dienstag, 24. Oktober 2023 um 13:36:11 UTC+2:
On 2023-10-24 06:49, minforth wrote:
Perhaps a new wordset COMPILER-EXTENSION would be better.
Also as a good place for recognizers, whenever that proposal makes it.
It's true for recognizers, since a program can affect the behavior of
the Forth text interpreter via Recognizer API (and even use it for its
own purposes).
But the words LATEST-NAME-IN and LATEST-NAME simply provide some
information from word lists, like the words FIND-NAME-IN or
TRAVERSE-WORDLIST do.
FIND-NAME-IN is exotic but I can guess... ;-)
Anyhow IMO it needs really good arguments to increase Forth's already overpopulated word zoo.
It's more libraries we need.
It bears repeating:
***********************************************************
* Names are SO not determining the identity of a word. *
***********************************************************
A name token is a single-cell value that identifies a Forth
definition. Note that it may not have a name.
On 25/10/2023 10:17 am, minforth wrote:
It's more libraries we need.Apparently not but feel free to provide them.
Ruvim schrieb am Dienstag, 24. Oktober 2023 um 13:36:11 UTC+2:
On 2023-10-24 06:49, minforth wrote:
Perhaps a new wordset COMPILER-EXTENSION would be better.
Also as a good place for recognizers, whenever that proposal makes it.
It's true for recognizers, since a program can affect the behavior of
the Forth text interpreter via Recognizer API (and even use it for its
own purposes).
But the words LATEST-NAME-IN and LATEST-NAME simply provide some
information from word lists, like the words FIND-NAME-IN or
TRAVERSE-WORDLIST do.
FIND-NAME-IN is exotic but I can guess... ;-)
Anyhow IMO it needs really good arguments to increase Forth's already overpopulated word zoo.
It's more libraries we need.
But I don't want to be negative, you asked for thoughts.
In article <uh954j$4q87$1@dont-email.me>, Ruvim <ruvim.pinka@gmail.com> wrote:
On 2023-10-24 08:37, albert wrote:
It bears repeating:
***********************************************************
* Names are SO not determining the identity of a word. *
***********************************************************
I agree. A word name does not identify the word.
A name token identifies the word, by its definition:
A name token is a single-cell value that identifies a named Forth
definition.
Almost correct.
A name token is a single-cell value that identifies a Forth
definition. Note that it may not have a name.
I can't getting the point accross.
The problem with LATEST that the obvious solution doesn't work.
The naive solution reading iso93 is returning an xt.
So what thingy is LATEST to return?
Sorry, I'm not following you here. I don't see how your question about
LATEST is related to my proposal.
The answer is not what it is that is returned. The answer is how it
should be named:
Possibly answers:
A name token
B dea
In any case it must be an answer that identifies a word/definition/you-know-what-I-mean.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 36:45:02 |
Calls: | 6,707 |
Files: | 12,239 |
Messages: | 5,353,438 |