home .. forth .. colorforth mail list archive ..

Re: [colorforth] DOES> How is colorForth different from other Forths?


On Sun, 14 Dec 2003, Samuel A. Falvo II wrote:

> On Sunday 14 December 2003 12:36 pm, Jeff wrote:
> > 0 constant struct
> >
> > : field ( n -- n ) dup create , 1+ does @ cells + ;
> > : end-struct ( n -- ) create , does create @ cells allot ;
>
> As far as I have learned from prior demonstrations and documentation,
> Chuck doesn't condone the use of structures, which is a pity in the
> sense that x86 architecture is optimized for them and an x86 machine
> Forth ought to also exploit that.  Nonetheless, vectors are too often
> overlooked, and have a number of advantages over structures.

Is a structure not simply a contiguous collection of named fields?

: field0   ;
: field1   1 + ;
...

I've done something similar to this in colorForth, except I've found it
beneficial in my case to integrate both the allocation and computation of
a table of structures. Also I did not need reassignment, so the named
fields can actually fetch the element.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com