|
From: Slava P. <sl...@fa...> - 2008-06-30 04:31:55
|
Hi all,
Here is the syntax I've settled on:
TUPLE: foo slot-name ; ! untyped, mutable, initial value is f
TUPLE: foo { slot-name read-only } ; ! untyped, immutable
TUPLE: foo { slot-name integer } ; ! declared type, mutable
TUPLE: foo { slot-name initial: 0 } ; untyped, mutable, initial value 0
TUPLE: foo { slot-name integer initial: 0 } ; declared type, mutable,
initial value 0
TUPLE: foo { slot-name integer read-only } ; declared type, immutable
Now if a slot is immutable, no writer is generated. This means the only way
to assign a value to an immutable slot is to construct the tuple with 'boa',
passing all values on the stack.
The literal syntax, which will come later, will look like this:
T{ foo f "hi" } ! 'BOA'-style literal
T{ foo { slot-name "hi" } } ! 'assoc'-style literal
I hope this syntax makes everyone happy.
I still want to redesign the proposed multi-method syntax to avoid the | in
stack effects, after a recent epiphany regarding the evilness of complex
lexing rules. Any suggestions there? This seems ugly:
: nth ( { i integer } { a array } -- elt ) ... ;
Slava
|