Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.forth

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 04-12-2012, 08:48 PM
Mark Wills
Guest
 
Posts: n/a
Default :NONAME

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
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 04-12-2012, 09:53 PM
Andrew Haley
Guest
 
Posts: n/a
Default Re: :NONAME

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.
Reply With Quote
  #3 (permalink)  
Old 04-12-2012, 09:54 PM
BruceMcF
Guest
 
Posts: n/a
Default Re: :NONAME

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.
Reply With Quote
  #4 (permalink)  
Old 04-12-2012, 10:08 PM
Zbiggy
Guest
 
Posts: n/a
Default Re: :NONAME

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)
Reply With Quote
  #5 (permalink)  
Old 04-12-2012, 11:54 PM
Elizabeth D. Rather
Guest
 
Posts: n/a
Default Re: :NONAME

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."
==================================================
Reply With Quote
  #6 (permalink)  
Old 04-13-2012, 06:50 AM
The Beez
Guest
 
Posts: n/a
Default Re: :NONAME

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

Reply With Quote
  #7 (permalink)  
Old 04-13-2012, 06:58 AM
Mark Wills
Guest
 
Posts: n/a
Default Re: :NONAME

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?
Reply With Quote
  #8 (permalink)  
Old 04-13-2012, 07:11 AM
Elizabeth D. Rather
Guest
 
Posts: n/a
Default Re: :NONAME

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."
==================================================
Reply With Quote
  #9 (permalink)  
Old 04-13-2012, 11:31 AM
Ian Osgood
Guest
 
Posts: n/a
Default Re: :NONAME

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
Reply With Quote
  #10 (permalink)  
Old 04-13-2012, 12:15 PM
BruceMcF
Guest
 
Posts: n/a
Default Re: :NONAME

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

Reply With Quote
  #11 (permalink)  
Old 04-13-2012, 12:34 PM
BruceMcF
Guest
 
Posts: n/a
Default Re: :NONAME

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.
Reply With Quote
  #12 (permalink)  
Old 04-13-2012, 01:00 PM
Andrew Haley
Guest
 
Posts: n/a
Default Re: :NONAME

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.
Reply With Quote
  #13 (permalink)  
Old 04-13-2012, 01:02 PM
Andrew Haley
Guest
 
Posts: n/a
Default Re: :NONAME

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.
Reply With Quote
  #14 (permalink)  
Old 04-13-2012, 01:19 PM
Mark Wills
Guest
 
Posts: n/a
Default Re: :NONAME

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?!

:-)
Reply With Quote
  #15 (permalink)  
Old 04-13-2012, 02:26 PM
BruceMcF
Guest
 
Posts: n/a
Default Re: :NONAME

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.
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 01:10 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.