Hi all,
Just a quick heads-up on a new feature in the core. A few people have
been doing introspection by looking at the "slots" word-prop. Before
it would contain an array of arrays like this:
( scratchpad ) TUPLE: color red green blue ;
( scratchpad ) \ color "slots" word-prop .
{
{ 3 object delegate set-delegate }
{ 4 object color-red set-color-red }
{ 5 object color-green set-color-green }
{ 6 object color-blue set-color-blue }
}
It was a bit of a pain extracting the fields with 'first', 'second',
etc, and the resulting code would be a bit ugly. Slot specifiers are
tuples now, and fields can be extracted using named accessor words,
as usual:
( scratchpad ) TUPLE: color red green blue ;
( scratchpad ) \ color "slots" word-prop .
{
T{ slot-spec f object "delegate" 3 delegate set-delegate }
T{ slot-spec f object "red" 4 color-red set-color-red }
T{ slot-spec f object "green" 5 color-green set-color-green }
T{ slot-spec f object "blue" 6 color-blue set-color-blue }
}
( scratchpad ) \ color "slots" word-prop second describe
an instance of the slot-spec class
slot-spec-decl object
slot-spec-name "red"
slot-spec-# 4
slot-spec-reader color-red
slot-spec-writer set-color-red
Slava
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk