|
|||
|
I think I read the other day, :NONAME pushes an xt on the stack
allowing the compiled word to be executed with EXECUTE. I take it that LATEST and HERE are *not* changed when a :NONAME definition is built? I.e the word is fleeting - it exists for as long as you have the XT, and is overwritten by the next compiling activity, such as , CREATE : etc Would that be accurate? Mark |
|
|
||||
|
||||
|
|
|
|||
|
Mark Wills <markrobertwills@yahoo.co.uk> wrote:
> I think I read the other day, :NONAME pushes an xt on the stack > allowing the compiled word to be executed with EXECUTE. > > I take it that LATEST and HERE are *not* changed when a :NONAME > definition is built? LATEST must be: you need RECURSE to work; RECURSE calls LATEST. HERE has to change too, because that's probably where the code goes. Andrew. |
|
|||
|
On Apr 12, 4:48*pm, Mark Wills <markrobertwi...@yahoo.co.uk> wrote:
> I think I read the other day, :NONAME pushes an xt on the stack > allowing the compiled word to be executed with EXECUTE. > I take it that LATEST and HERE are *not* changed when a :NONAME > definition is built? I.e the word is fleeting - it exists for as long > as you have the XT, and is overwritten by the next compiling activity, > such as , CREATE : etc > Would that be accurate? Nope, its completely backwards. (1) If any data space has been allocated ~ including the common situation where code space is in data space and so every single word compiled allocates data space ~ HERE *must* change. (2) Whatever DOES> uses to work out what to modify when it executed, then :NONAME *must* update that. The word is not fleeting, otherwise you couldn't put the XT in a constant or a vector table for later execution. |
|
|||
|
In comp.lang.forth, Mark Wills wrote:
> I think I read the other day, :NONAME pushes an xt on the stack > allowing the compiled word to be executed with EXECUTE. > > I take it that LATEST and HERE are *not* changed when a :NONAME > definition is built? Why? IMHO HERE _has_ to be changed, when new definition has been added. New xt is a proof, that you've got another tool at your disposal. It's definition could be overwritten, if HERE would stay at its earlier address. -- Forth is a preserver of health (Hippocrates) |
|
|||
|
On 4/12/12 10:48 AM, Mark Wills wrote:
> I think I read the other day, :NONAME pushes an xt on the stack > allowing the compiled word to be executed with EXECUTE. > > I take it that LATEST and HERE are *not* changed when a :NONAME > definition is built? I.e the word is fleeting - it exists for as long > as you have the XT, and is overwritten by the next compiling activity, > such as , CREATE : etc > > Would that be accurate? No. As others have pointed out, the code very definitely goes in the dictionary and is there permanently (unless discarded by, e.g., MARKER). HERE will be modified if the implementation combines code and data space. LATEST will definitely change. In other words, this is a definition like any other colon definition except that it does not have a FINDable name; access is only through its xt. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ================================================== |
|
|||
|
On Apr 12, 11:53*pm, Andrew Haley <andre...@littlepinkcloud.invalid>
wrote: > LATEST must be: you need RECURSE to work; RECURSE calls LATEST. *HERE > has to change too, because that's probably where the code goes. True, otherwise anonymous recursion won't work. I have some experience there myself. Hans Bezemer |
|
|||
|
On Apr 12, 10:54*pm, BruceMcF <agil...@netscape.net> wrote:
> > The word is not fleeting, otherwise you couldn't put the XT in a > constant or a vector table for later execution. There doesn't seem to be much point in it then, quite frankly. I mean, it gets compiled, and leaves it's xt. Wowee. You mean like: : thing ... ; ' thing Am I missing something here? |
|
|||
|
On 4/12/12 8:58 PM, Mark Wills wrote:
> On Apr 12, 10:54 pm, BruceMcF<agil...@netscape.net> wrote: >> >> The word is not fleeting, otherwise you couldn't put the XT in a >> constant or a vector table for later execution. > > There doesn't seem to be much point in it then, quite frankly. I mean, > it gets compiled, and leaves it's xt. Wowee. You mean like: > > : thing ... ; > ' thing > > Am I missing something here? Not really. The theory is that you can do something like: DEFER FOO :noname <default action> ; IS FOO :noname <option1> ; CONSTANT OPTION1 :noname <option2> ; CONSTANT OPTION2 OPTION1 IS FOO ....and this vector to your favorite option. I'm with you on this one. I don't see much point, but there are those who love it. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ================================================== |
|
|||
|
On Apr 12, 11:58*pm, Mark Wills <markrobertwi...@yahoo.co.uk> wrote:
> On Apr 12, 10:54*pm, BruceMcF <agil...@netscape.net> wrote: > > > > > The word is not fleeting, otherwise you couldn't put the XT in a > > constant or a vector table for later execution. > > There doesn't seem to be much point in it then, quite frankly. I mean, > it gets compiled, and leaves it's xt. Wowee. You mean like: > > : thing ... ; > ' thing > > Am I missing something here? Sometimes you only want to refer to a word by index rather than by name. :NONAME gives you a mechanism to create an array of functions without filling the dictionary with meaningless function names. http://rosettacode.org/wiki/Roman_numerals/Encode#Forth Also, :NONAME/DEFER gives you a mechanism for forward declaration which is otherwise absent, for implementing things like vectored execution and mutual recursion. Ian |
|
|||
|
On Apr 13, 2:58*am, Mark Wills <markrobertwi...@yahoo.co.uk> wrote:
> On Apr 12, 10:54*pm, BruceMcF <agil...@netscape.net> wrote: > > The word is not fleeting, otherwise you couldn't put the XT in a > > constant or a vector table for later execution. > There doesn't seem to be much point in it then, quite frankly. I mean, > it gets compiled, and leaves it's xt. Wowee. You mean like: > : thing ... ; > ' thing > Am I missing something here? All you're missing with :NONAME is the "thing" name. It can be useful as a factor in some situations, since if what you want is an xt to work with rather than a name, you don't have to come up with a dummy name. Look up mini-oof and its examples to see a common scenario where some people like to use it. One assumes that the name comes from the following pattern to get the same effect by hand in a fairly self-documenting way ~ if MyVector is an XT vector that has been previously allocated, and is filled up one at a time by "AppendXT", then ... : NONAME ( ... ) ... ; ' NONAME MyVecter AppendXT |
|
|||
|
On Apr 12, 5:53*pm, Andrew Haley <andre...@littlepinkcloud.invalid>
wrote: > Mark Wills <markrobertwi...@yahoo.co.uk> wrote: > > I think I read the other day, :NONAME pushes an xt on the stack > > allowing the compiled word to be executed with EXECUTE. > > I take it that LATEST and HERE are *not* changed when a :NONAME > > definition is built? > LATEST must be: you need RECURSE to work; RECURSE calls LATEST. *HERE > has to change too, because that's probably where the code goes. RECURSE has to somehow work out what the current definition is. If it does that by calling LATEST, then either LATEST must change, or else RECURSE written to call something else. |
|
|||
|
Mark Wills <markrobertwills@yahoo.co.uk> wrote:
> On Apr 12, 10:54?pm, BruceMcF <agil...@netscape.net> wrote: >> >> The word is not fleeting, otherwise you couldn't put the XT in a >> constant or a vector table for later execution. > > There doesn't seem to be much point in it then, quite frankly. I mean, > it gets compiled, and leaves it's xt. Wowee. You mean like: > > : thing ... ; > ' thing > > Am I missing something here? Not really. It's just a small useful factor. There are many cases where you need to define a word but don't need to give it a name. defer factor ... :noname ... ; is factor is by far the nicest way to do it. And, IMO, it provides a perfectly decent way to do recursion without RECURSE , but I may be in a minority of one with that opinion! Andrew. |
|
|||
|
BruceMcF <agila61@netscape.net> wrote:
> On Apr 12, 5:53?pm, Andrew Haley <andre...@littlepinkcloud.invalid> > wrote: >> Mark Wills <markrobertwi...@yahoo.co.uk> wrote: >> > I think I read the other day, :NONAME pushes an xt on the stack >> > allowing the compiled word to be executed with EXECUTE. > >> > I take it that LATEST and HERE are *not* changed when a :NONAME >> > definition is built? > >> LATEST must be: you need RECURSE to work; RECURSE calls LATEST. ?HERE >> has to change too, because that's probably where the code goes. > > RECURSE has to somehow work out what the current definition is. If it > does that by calling LATEST, then either LATEST must change, or else > RECURSE written to call something else. But LATEST is defined simply as the word with this functionality: it points to the latest definition. It doesn't have to be called LATEST, obviously. Andrew. |
|
|||
|
On Apr 13, 2:00*pm, Andrew Haley <andre...@littlepinkcloud.invalid>
wrote: > Mark Wills <markrobertwi...@yahoo.co.uk> wrote: > > On Apr 12, 10:54?pm, BruceMcF <agil...@netscape.net> wrote: > > >> The word is not fleeting, otherwise you couldn't put the XT in a > >> constant or a vector table for later execution. > > > There doesn't seem to be much point in it then, quite frankly. I mean, > > it gets compiled, and leaves it's xt. Wowee. You mean like: > > > : thing ... ; > > ' thing > > > Am I missing something here? > > Not really. *It's just a small useful factor. *There are many cases > where you need to define a word but don't need to give it a name. > > defer factor > > *... > > :noname *... ; *is factor > > is by far the nicest way to do it. *And, IMO, it provides a perfectly > decent way to do recursion without RECURSE , but I may be in a > minority of one with that opinion! > > Andrew. > :noname ... ; is factor But hang on... if you needed to assign the anonymous definition to a defferred word, then it *did* need a name, didn't it?! :-) |
|
|||
|
On Apr 13, 9:02*am, Andrew Haley <andre...@littlepinkcloud.invalid>
wrote: > BruceMcF <agil...@netscape.net> wrote: > > On Apr 12, 5:53?pm, Andrew Haley <andre...@littlepinkcloud.invalid> > > wrote: > >> Mark Wills <markrobertwi...@yahoo.co.uk> wrote: > >> > I think I read the other day, :NONAME pushes an xt on the stack > >> > allowing the compiled word to be executed with EXECUTE. > > >> > I take it that LATEST and HERE are *not* changed when a :NONAME > >> > definition is built? > > >> LATEST must be: you need RECURSE to work; RECURSE calls LATEST. ?HERE > >> has to change too, because that's probably where the code goes. > > > RECURSE has to somehow work out what the current definition is. If it > > does that by calling LATEST, then either LATEST must change, or else > > RECURSE written to call something else. > But LATEST is defined simply as the word with this > functionality: it points to the latest definition. >*It doesn't have to be called LATEST, obviously. The question is how the functionality is provided ~ in a system with no headerless definitions, pointing to the most recently created dictionary entry works to get to the most recently created definition. But if its sometimes used to get the most recent definition, and sometimes used to get the most recently created dictionary entry, then those two uses have to be split up if support for headerless definition is added. |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|