Hi all,
Doug came up with this idea and I implemented it in extra/constructors.
Suppose you have a tuple,
TUPLE: stock-spread stock spread timestamp ;
Instead of writing
: <stock-spread> ( stock spread -- stock-spread )
stock-spread new
swap >>spread
swap >>stock
now >>timestamp ;
You can write
CONSTRUCTOR: stock-spread ( stock spread -- stock-spread )
now >>timestamp ;
Note that the setter words are implicit from the stack effect
declaration. This is a generalization of C: because you don't have to
set all the slots, you can set them in any order, and you can provide
an init quotation.
It's just an experiment for now, but if it proves popular we can move
it in core and remove C:, since this more or less completely
supercedes C:.
Slava
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk