Re: [colorforth] Dare I say ANS!
- Subject: Re: [colorforth] Dare I say ANS!
- From: "Samuel A. Falvo II" <kc5tja@xxxxxxxx>
- Date: Thu, 15 Jan 2004 09:57:01 -0800
On Thursday 15 January 2004 05:22 am, Howerd Oakford wrote:
> Make i return an index from 0 to n-1 instead of 1 to n. I presume this
> was intentional - does any one know why?
Because implementing FOR/NEXT is substantially easier to implement than
DO/LOOP.
> ?dup - what is this?
This is part of Chuck's peephole optimizer. It detects if a DROP
preceeded the word, and if so, "backspaces over the DROP," so that the
literal can be loaded into EAX directly, instead of taking the time to
first DROP, then DUP, then load EAX.
> I think we should use whatever the ANS form is for 1@, 2@ etc ( c@ w@
> I think ).
ANSI defines only @ and C@. There is no equivalent to 1@ or 2@.
Frankly, I prefer 1@ and 2@ over C@ -- the former indicates firmly how
many bytes are being fetched, while the latter is rather ambiguous and
platform dependent (e.g., are we running the Forth on a Unicode system?
If so, a character may be 16-bits wide. Or, even 32-bits. Otherwise,
it's generally accepted to be only 8-bits. Moreover, IIRC, ANSI Forth
has some ambiguities over whether C@ is to fetch a *character* versus a
*byte*. E.g., the word COUNT, for example, is defined for strings that
do not exceed 255 characters; it's behavior isn't well defined for
strings exceeding 255 characters. This implies that C@ fetches a byte.
Yet, ANSI insists that C@ may fetch characters wider than 8-bits. Had
enough yet?)
> Does anyone know if "port fetch" has an ANS name? polyForth uses INPUT
> and OUTPUT, p@ and p! is fine by me.
No. Again, port-fetch is extremely x86 specific.
--
Samuel A. Falvo II
---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com