In article <
5797d264-cb1d-4d07...@googlegroups.com>,
Marcel Hendrix <
m...@iae.nl> wrote:
>On Sunday, January 22, 2023 at 2:39:25 PM UTC+1, none albert wrote:
>> Before long I have used { and } for
>> :NONAME ... ;
>> and for
>> : .... [: ... ;] ;
>> alike.
>>
>> The only addition was
>> : { ... STATE @ .. ;
>> : } ... STATE ! .. ;
>>
>> The sequence { .. } leaves a literal, that should not be different
>> from interpret or compile state, compare the notation 'A' that is
>> valid through interpret and compile state and leave the same literal.
>
>You could have been more explicit when stating that this is simple in
>traditional Forth, and some examples why you think different Forths
>might have problems would have helped understanding the issues.
I could not possibly predict what problems more complicated
Forth's have.
>
>In e.g. iForth :NONAME is not really different from : , that is, locals
>and recursion are supported, and there is compiler security.
>For instance, locals require that the locals wordlist is first in the
>search-order. Therefore ";" and some other words have to undo that
>effect. A straightforward :NONAME will therefore make the locals
>of the surrounding word invisible, while the point of the embedded
>definition may be to export same. Also, RECURSE and MYSELF after
>the :NONAME .. ; might find the wrong xt, and compiler security
>may check that colon definitions are not accidentally nested and
>that the compiler stack balances.
I have an other take on this.
"local value" 's are a design error, and leads to a cul-de-sac.
My experimental lucky7 has not merely local definitions that are
identical to outside definitions. (So if you have class rectangle
you can define a rectangle inside.)
Also a local execution word can have their own locals and their own
local execution words and so on recursively.
You give up on re-entrancy that is a dogma
>At least a subroutine-threaded compiler for sure will lay down
>code for the :NONAME , and that code will be right in the middle
>of the enclosing word if nothing special (markers?) is done.
I do nothing special and it is right in the middle of the enclosing
word. So what? In my philosophy, if you aim for extreme speed,
you use an optimiser.
>
>Maybe there is no problem when the Forth considers data inside a
>colon definition as pure data and maintains that data as lists, but
>these fine points of Forth are by now 40 years old and forgotten
>(by me).
Lists are practical, but not for Forth with a million words.
The words that would be local to e.g. MERGE-SORT would be less
than a dozen, and a list is practical.
>
>-marcel