Hugh Greene | 29 Apr 00:34

Re: [hackers] Limited collections and type-for-copy

without-lurking

On Monday 28 Apr 2008 01:40, agentmail <at> gmail.com wrote:
> Looking over the unit tests for Gwydion Dylan, I see that none of map,
> etc, work with limited collections. This is probably because type-for-
> copy returns limited collection types and those functions don't know
> how to instantiate limited collection types properly.

I haven't looked at the code, so the following is guesswork and hand-waving 
(and maybe not useful -- it is kinda late here :-)

> limited() returns a <limited-collection>. A <limited-collection> isn't
> actually a collection -- none of its superclasses is <collection>.
> Instead, it is basically a limited collection specifier. make on
> <limited-collection> calls make-limited-collection to instantiate the
> actual collection.
>
> The actual collection (which inherits from <limited-collection-mixin>)
> has an additional init-keyword, collection-type:, beyond what the base
> collection class (<simple-vector> or whatever) has.
>
> type-for-copy doesn't treat <limited-collection-mixin> collections any
> differently from other collections, so calling type-for-copy returns
> the subclass of <limited-collection-mixin>. But when map tries to
> instantiate that type, it fails, because that type has the extra init-
> keyword parameter.

Well, going by the spec, map (and other methods which are defined to delegate 
to type-for-copy) should only be expected to work for those limited 
collection types which are instantiable (the concrete 
(Continue reading)


Gmane