On Tuesday 08 July 2008 13:32:46 Slava Pestov wrote:
> I've removed three usages of -roll just now. Here are the before and after:
> : >c-array ( seq type word -- )
> : >
> >r >r dup length dup r> <c-array> dup -roll r>
>
> [ execute ] 2curry 2each ; inline
>
> : >c-array ( seq type word -- )
>
> [ [ dup length ] dip <c-array> ] dip
> [ [ execute ] 2curry each-index ] 2keep drop ; inline
Slava,
Awhile back you mentioned the possibility of overhauling the C FFI to allow
for new style getters and setters on C structs. You mentioned that this would
involve promoting objects which represent C entities to a more "first class"
state. For example, for a new style accessor like:
abc>>
to work on a struct, it would have to dispatch on the type of that struct
(structs don't currently carry their type information).
In a similar spirit, it seems that if c-array objects carried their type, code
like the above '>c-array' would be cleaner because sequence methods would be
usable (i.e. 'nth' would get the logical element, not the byte).
So my question is, do you foresee having typed c-array objects?
Ed
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk