Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IT as the name for returning last xt

6 views
Skip to first unread message

Michael L.Gassanenko

unread,
Mar 15, 2003, 2:34:15 AM3/15/03
to
I often use

IT ( -- xt ) return execution token of the last defined word

I want to add an entry for it to the comp.lang.forth repository http://forth.sf.net/word

I now that in gForth it is called lastxt, but I dislike the word lastxt
for the following reason: "execution token" is a word monster.
None of the standard Forth words includes "xt" in the name,
and no Forth word should include a mention of this auxiliary concept in its name.
The OTA standard renamed "execution tokens" to "execution pointers".
Should the programmer rename LASTXT to LASTXP on OTA? IMO, the name must
be chosen so that there would be no such problems.
In addition, it is quite possible that on the next revision the term "xt" will
be replaced in the standard by omething else, as it nearly happened with
"semantics", another word monster that almost has been renamed to "behavoiur".
So: auxiliary terms like "semantics" or "tokens" must not appear in the code.

----

1) Typical use

DEFER foo
...
: bar
blah blah blah
;
IT IS foo


2) Advantages

This word allows us to solve the :NONAME problem -- xt not accessible
till eexcution of ; (semi-colon).

That is,

DEFER EMIT
:- DUP RSEMIT LCDEMIT ; IT IS EMIT

instead of

:NONAME DUP RSEMIT LCDEMIT ; IS EMIT

and

: M: ' method>offset >R :- IT ^virtual-function-table R> + ! ;

and there will be no need for ;M

It becomes easy to redefine ; to support : -like words:

0 VALUE my-latest
: my: : bla bla bla IT IS my-latest ;
: ; IT my-latest = IF bla bla bla THEN POSTPONE ; ; IMMEDIATE

Guido Draheim

unread,
Mar 16, 2003, 12:57:48 PM3/16/03
to
I don't like it.

I think that everyone has been thinking of using IT for something
really clever, it's a nice short word - and I'd say that we
should leave it for application usage.

I want to support that argument also with real life experience
in the telco world where there are a whole lot of abbreviations
for various services, signals, connectors around. All too often
now I see people making a SYNONYM at the file-start to get a
second name for an ANS forth word that is needed in the
implemenation but coincides with a common term of the application.

May be you would be okay with providing a long name for IT that
you could make an ALIAS for in your sources. As to your
questoin, should a programmer rename LASTXT and similar?
Hear my soundly answer - yes, he should.

What about a little survey of what modes exist around that
are usuable to get access to the last code-area, header-area
of the latest definition? Sometimes things can get really
confusing, ye know... and that's what your question might
really targetting at, isn't it.

-- cheers, guido


Michael L.Gassanenko schrieb:

Anton Ertl

unread,
Mar 16, 2003, 4:49:51 PM3/16/03
to
"Michael L.Gassanenko" <m_l...@yahoo.com> writes:
>I often use
>
>IT ( -- xt ) return execution token of the last defined word
>
>I want to add an entry for it to the comp.lang.forth repository http://forth.sf.net/word
>
>I now that in gForth it is called lastxt, but I dislike the word lastxt
>for the following reason: "execution token" is a word monster.
>None of the standard Forth words includes "xt" in the name,
>and no Forth word should include a mention of this auxiliary concept in its name.

_How_ often do you use it? How often do others use LASTXT? In the
Gforth sources it occurs 27 times (out of about 30000 lines of Forth
code). That low frequency calls for a word with a mnemonic name, not
something unspecific like it. LASTXT is mnemonic because it
piggybacks on the word LAST and adds XT, a widely-used abbreviation
(2380 clf postings according to google).

>The OTA standard renamed "execution tokens" to "execution pointers".
>Should the programmer rename LASTXT to LASTXP on OTA?

Why have they renamed XT? And should the programmer rename it into
her on OTA?

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html

Roman Pavlyuk

unread,
Mar 16, 2003, 5:50:29 PM3/16/03
to
> >
> > IT ( -- xt ) return execution token of the last defined word
> >

In Forth-83, as far as I remember we used LATEST NAME> for this
purpose. I liked the word LATEST :)

BR,
Roman

Elizabeth D. Rather

unread,
Mar 16, 2003, 6:00:16 PM3/16/03
to
Anton Ertl wrote:

> >The OTA standard renamed "execution tokens" to "execution pointers".
> >Should the programmer rename LASTXT to LASTXP on OTA?
>
> Why have they renamed XT? And should the programmer rename it into
> her on OTA?

It was renamed because the OTA concept was technically different (though
analogous), and we thought it would prevent confusion.

Cheers,
Elizabeth


Coos Haak

unread,
Mar 16, 2003, 7:09:56 PM3/16/03
to
On 16 Mar 2003 14:50:29 -0800, jo...@eleks.lviv.ua (Roman Pavlyuk)
wrote:

But LATEST or LAST in some implementations points somewhere in the
header that might be absent in e.g. applications.
LASTXT points to the execution token, that's "always" present and is
faster because NAME> could take time, but less than >NAME ;-)

Coos

Julian V. Noble

unread,
Mar 16, 2003, 11:45:39 AM3/16/03
to
"Michael L.Gassanenko" wrote:
>
> I often use
>
> IT ( -- xt ) return execution token of the last defined word
>
> I want to add an entry for it to the comp.lang.forth repository http://forth.sf.net/word
>
> I now that in gForth it is called lastxt, but I dislike the word lastxt
> for the following reason: "execution token" is a word monster.

I agree with the motivation, but how about THAT ?


--
Julian V. Noble
Professor of Physics
j...@virginia.edu

"Science knows only one commandment: contribute to science."
-- Bertolt Brecht, "Galileo".

Michael L.Gassanenko

unread,
Mar 17, 2003, 4:16:20 PM3/17/03
to

1)
NAME> assumes that there is some access to the name field, which may
not be true on, say, a cross-compiler. (This is a part of the cost paid
for a better level of compatibility with taditional Forth)

2)
IIRC about 50% of systems used LATEST while the other about 50% used LAST @ .
In addition, Larionov's (IIRC) Forth used LATEST to mean LAST or vice versa.

--
101% -- Central Administration of Statistics (of USSR)

Michael L.Gassanenko

unread,
Mar 17, 2003, 4:27:54 PM3/17/03
to
"Julian V. Noble" wrote:
>
> "Michael L.Gassanenko" wrote:
> >
> > I often use
> >
> > IT ( -- xt ) return execution token of the last defined word
> >
> > I want to add an entry for it to the comp.lang.forth repository http://forth.sf.net/word
> >
> > I now that in gForth it is called lastxt, but I dislike the word lastxt
> > for the following reason: "execution token" is a word monster.
>
> I agree with the motivation, but how about THAT ?
>

THIS -- should be left for OOP
THAT --

defer bar
: foo
...
; that is bar -- no good

I would reserve THAT for the 2nd element on the stack of objects.


What about LATTER ?

defer bar
: foo
...
; latter is bar

Coos Haak

unread,
Mar 17, 2003, 4:58:30 PM3/17/03
to

Grin, why not use LATEST or LAST ?

Coos

Guido Draheim

unread,
Mar 17, 2003, 5:00:32 PM3/17/03
to

Coos Haak schrieb:

what about LAST-DEFINITION then :-)=)

1) Typical use

DEFER foo
...
: bar
blah blah blah
;

LAST-DEFINITION IS foo


Roman Pavlyuk

unread,
Mar 17, 2003, 8:26:21 PM3/17/03
to
> >purpose. I liked the word LATEST :)
> LASTXT points to the execution token, that's "always" present and is
> faster because NAME> could take time, but less than >NAME ;-)

Yes, I wondered why ' returned CFA, and LATEST returned NFA (well,
>NAME is incorrect operation - you cannot find NFA given a CFA, can
you?), but I just wanted to tell that LATEST sounded very nice to me
:).

BR,
Roman

Coos Haak

unread,
Mar 18, 2003, 12:16:40 PM3/18/03
to
On 17 Mar 2003 17:26:21 -0800, jo...@eleks.lviv.ua (Roman Pavlyuk)
wrote:

>> >purpose. I liked the word LATEST :)

In my Forth, both >NAME and NAME> are correct operations, why not?
Just not in a headerless application.

Coos

Michael L.Gassanenko

unread,
Mar 18, 2003, 5:42:32 PM3/18/03
to

Already in common use
VARIABLE LAST \ name field address (nfa) of the last word
: LATEST ( -- nfa )
LAST @
;

>
> what about LAST-DEFINITION then :-)=)

Too long.

So why not LATTER ?

Alex McDonald

unread,
Mar 18, 2003, 6:06:36 PM3/18/03
to

"Michael L.Gassanenko" <m_l...@yahoo.com> wrote in message
news:3E77A0D8...@yahoo.com...

DEFER foo
: bar .. ;
PRIOR IS foo
( or, my preference )
WHICH IS foo

Extendable to

WHICH@ foo ( returns ' bar )

that Win32Forth implements as DEFER@. THAT, LATTER, PRIOR and LASTx's don't
lend themselves to this treatment.

--
Regards
Alex McDonald


Guido Draheim

unread,
Mar 18, 2003, 6:06:03 PM3/18/03
to
Michael L.Gassanenko schrieb:

you can create an ALIAS for it in your application.
The word is too specific anyway, so it won't be
given a short name anyway, not even the LATTER.

Most of the people are fine with
: what ... ;
LATEST NAME> IS foo

or
:noname ... ; IS foo

That's my main point about it.

See, if you want to have a shortname for such a
beast in your forth, well, go ahead, but don't put
it on forth.sf.net as no one else recommends it.
The only heritage is the LASTXT that you've pointed
to, but it didn't spread out in real life, it's a
helper definition and as such in can stay somewhat
technical in its naming policy. An application
should use one of the portable things as listed
above, it does actually cover all realworld case.
May be you want to have your own style, but I do
not like to see forth to get too much of TMTOWTDI
style, keep it clean and minimal. And don't pollute
the range of short names in forth even more than we
already have, keep it open for applications to
be exported as an application-specific user method.
We already have too many shortnames registered, and
it's a fact that it is not particularly useful to
redefine them for application needs even that such is
possible - it could easily be confusing for the next
programmer to get to work on that piece of software.

To summarize: do not register a shortname for a
thing that is already covered with existing
syntax parts of forth. That's my POV. -- guido

Anton Ertl

unread,
Mar 21, 2003, 9:09:12 AM3/21/03
to
Guido Draheim <guidod...@gmx.de> writes:
>Most of the people are fine with
>: what ... ;
>LATEST NAME> IS foo
>
>or
>:noname ... ; IS foo
...

>The only heritage is the LASTXT that you've pointed
>to, but it didn't spread out in real life, it's a
>helper definition and as such in can stay somewhat
>technical in its naming policy.

What do you mean by "helper definition"? LASTXT is essential in
combination with "NONAME":

5 noname constant
lastxt is ...

However, LASTXT should be called LATESTXT, since it is value-flavoured
like LATEST, not variable-flavoured like LAST.

Anton Ertl

unread,
Mar 21, 2003, 11:55:39 AM3/21/03
to
jo...@eleks.lviv.ua (Roman Pavlyuk) writes:
>In Forth-83, as far as I remember we used LATEST NAME> for this
>purpose. I liked the word LATEST :)

Since F83 does not have it, I doubt that it is in Forth-83. However,
fig-Forth has it.

0 new messages