RfD: Third draft of Structures
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.forth Profile…
 Up
Re: Third draft of Structures         


Author: Charles Melice
Date: Oct 3, 2006 07:25

"Stephen Pelc" mpeforth.com> a
no comments
RfD: Third draft of Structures         


Author: Stephen Pelc
Date: Aug 30, 2006 03:03

This the best compromise I can get to, taking into account all
contributions so far. The compromises in this draft take into
account name conflicts, stack effect conflicts, alignment and
fat/thin implementations.

Stephen

RfD: Structures - Version 3
30 August 2006, Stephen Pelc

Change History
==============
20060830 Removed some restrictions on FIELD: and children.
Moved some words to FLOATING EXT.
20060827 Added alignment to discussion.
20060822 Rewrite after criticism
20060821 First draft

To Do
=====
Test cases.

Rationale
=========
Show full article (9.89Kb)
14 Comments
Re: RfD: Third draft of Structures         


Author: Anton Ertl
Date: Sep 2, 2006 09:25

stephenXXX@mpeforth.com (Stephen Pelc) writes:
>Mitch Bradley wrote the following about structure alignment:
...
>Since I do much more (b) than (a), I prefer a structure definition
>basis
>that is fundamentally unaligned. It is much easier to add alignment
>than to undo it."

He also wrote that he liked (the semantics of) Gforth's FIELD, which
does support, but not enforce alignment.

In particular, if you want unaligned fields, the only cost is that you
have to write an additional "1" per field. I would like to see a
rationale by you why you consider that worse than your proposal. The
only rationale I have seen by you is that you have had problems with
C; but Gforth is not C, and Gforth's FIELD does something different
than C; in particular:
Show full article (2.22Kb)
no comments
Re: Naming of Standard words         


Author: ward mcfarland
Date: Oct 5, 2006 04:01

slava@jedit.org jedit.org> wrote:
> In Factor (which is definitely not an ANS Forth) I use the convention
> that parsing words which read ahead from the input have names ending
> with a colon. I find it makes code easier to follow.

I find myself liking this style for words that require a termination
word.

Thus I would prefer
RECORD: .... ;RECORD
to
RECORD .... END-RECORD (or was it ENDRECORD, END_RECORD, RECORD-END)

and

CODE: ... ;CODE
to
CODE ... END-CODE

While I have no problem with CREATE VARIABLE VALUE etc since they do
not need a completion word.
no comments
Re: Naming of Standard words         


Author: Ed
Date: Oct 6, 2006 20:21

"Andreas Kochenburger" nospam.com> wrote in message news:93n9i215gmd15sdgokn0s8pu0e7cv37fgb@4ax.com...
> On Thu, 5 Oct 2006 11:29:08 +0200, "Charles Melice" forthcad.com>
> wrote:
>>Yes. My preference is to define only OFFSET.
>>
>> 0
>> cell offset +X
>> cell offset +Y
>> constant Point
>
> Sorry, but that's the thinking of somebody who knows the innards of
> his Forth system.
> A) it is not guaranteed to work in other environments
> B) it is semantically poor
>
> STRUCTURE
> 12 chars FIELD name
> cell FIELD number
> END-STRUCTURE
> ...
Show full article (1.03Kb)
no comments
Re: Naming of Standard words         


Author: Charles Melice
Date: Oct 7, 2006 00:00

"Andreas Kochenburger" nospam.com> a
5 Comments
Re: Naming of Standard words         


Author: jacko
Date: Oct 7, 2006 07:07

Charles Melice wrote:
> "Andreas Kochenburger" nospam.com> a écrit dans le message de news:
> 93n9i215gmd15sdgokn0s8pu0e7cv37fgb@4ax.com...
>> On Thu, 5 Oct 2006 11:29:08 +0200, "Charles Melice" forthcad.com>
>> wrote:
>>>Yes. My preference is to define only OFFSET.
>>>
>>> 0
>>> cell offset +X
>>> cell offset +Y
>>> constant Point
>>
>> Sorry, but that's the thinking of somebody who knows the innards of
>> his Forth system.
>> A) it is not guaranteed to work in other environments
>> B) it is semantically poor
>
>
> [offset (computer). (n.d.). Wikipedia, the free encyclopedia.
> Retrieved October 06, 2006, from Reference.com website: ...
Show full article (1.43Kb)
3 Comments
Re: Naming of Standard words         


Author: jacko
Date: Oct 7, 2006 07:33

jacko wrote:
> Charles Melice wrote:
> 2 CELL CELL IDX mystruct x y

: (IDX) CREATE + DUP , SWAP DOES> @ + ;
: IDX VOCABULARY DEFINITIONS CREATE 0 SWAP 0 DO (IDX) LOOP ;

CELL CELL 2 IDX mystruct x y

with revesrse order of sizes i.e. last CELL is size of x.
> note the blank line terminal. occam does not have parsed word terminals
> either.
>
> cheers.
2 Comments
Re: Naming of Standard words         


Author: jacko
Date: Oct 7, 2006 07:37

correction.
: (IDX) CREATE DUP , + DOES> @ + ;
: IDX VOCABULARY DEFINITIONS CREATE 0 SWAP 0 DO (IDX) LOOP ;

CELL CELL 2 IDX mystruct x y

with revesrse order of sizes i.e. last CELL is size of x..
1 Comment
Re: Naming of Standard words         


Author: Ed
Date: Oct 7, 2006 21:48

"Charles Melice" forthcad.com> wrote in message news:8cWdncjI_cQgzbrYnZ2dnUVZ8tKdnZ2d@scarlet.biz...
>
> "Andreas Kochenburger" nospam.com> a
no comments
1 2