Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Dylan > Limited collect...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 269 of 285
Post > Topic >>

Limited collections and type-for-copy

by agentmail@[EMAIL PROTECTED] Apr 27, 2008 at 05:40 PM

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.

limited() returns a <limited-collection>. A <limited-collection> isn't
actually a collection -- none of its supercl***** 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.

Now, I see two solutions. First, make map, etc. aware of limited
collection types and how to instantiate them. Second, make type-for-
copy on <limited-collection-mixin> return <limited-collection> instead
of the type of an actual collection.

The problem with solution number two is that the DRM specifies that
type-for-copy on a limited type must return a subtype of the base
collection class, and <limited-collection> isn't a subtype of any
collection class. I suppose we could implement instance? and subtype?
to treat <limited-collection> as if it were a subtype of its base
collection class (since that will presumably satisfy whatever
necessity led the DRM to include that stipulation), but I don't know
if that will screw up the runtime's own bookkeeping.

Opinions? Brilliant solutions?
 




 2 Posts in Topic:
Limited collections and type-for-copy
agentmail@[EMAIL PROTECTE  2008-04-27 17:40:57 
Re: Limited collections and type-for-copy
cgay <carlgay@[EMAIL P  2008-05-10 22:32:52 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 16:50:58 CDT 2008.