Dylan Design Notes

#1: Collection Class-For-Copy	(Clarification)

Version 1, March 1993
Copyright (c) 1993-1994, Apple Computer

This design note clarifies that class-for-copy of a collection must 
return a mutable collection.

-------------------------------------------------------------------

Replace the definition of class-for-copy on page 100 of the Dylan 
manual with the following:

class-for-copy   collection  =>  class	[G.F. Method]
class-for-copy returns an appropriate collection class for creating 
mutable copies of the argument.  For collections that are already 
mutable, the collection's actual class is generally the most 
appropriate, so the <object> method of class-for-copy can be used.  
The class-for-copy value of a sequence should be a subclass of 
<sequence>, and the class-for-copy value of an explicit-key-
collection should be a subclass of <explicit-key-collection>.  In 
all cases, the class-for-copy value must be a mutable collection.

-------------------------------------------------------------------

Notes:

The restriction on class-for-copy for collections is needed to keep 
the collection protocol relatively simple.

Implementations do not need to check for this explicitly.  Many 
built-in functions will, however, break if the restriction is not 
observed.


