Re: An "alias" for a location defined by VALUE

From: Elizabeth D. Rather <erather_at_forth.com>
Date: Tue, 15 Jan 2002 13:26:46 -0800

At 01:11 PM 1/15/02 -0800, Rick Van Norman wrote:
> >... So I would have defined
>
>: WIERD_VALUE ( N -- )
> CREATE 0 , /ALLOT DOES> @ ;
>
>and then all of the code is correct. HOwever, you would not be allowed to
>use TO for modifying ALPHA and would have to use a construct based on=
> writing
>to the address BETA returns.

Better still:

: WIERD_VALUE ( n -- )
    0 VALUE /ALLOT ;

Technically, ANS Forth doesn't guarantee that you can use a non-CREATE
defining word in such a way, but it does work in SwiftForth and most systems,
and lets you use TO for modifying it if you wish.

Cheers,
Elizabeth

================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310-491-3356
5155 W. Rosecrans Ave. #1018 Fax: +1 310-978-9454
Hawthorne, CA 90250
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
================================================

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.
Received on Tue Jan 15 2002 - 13:25:41 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.