Previous section: Collection Alignment

Dylan reference manual -- Defining a New Collection Class: A Summary

Defining a New Collection Class: A Summary

Every collection class must provide an implementation of the iteration protocol (forward-iteration-protocol; backward is optional).

Every collection must provide or inherit methods for element and key-test. If the collection is also a <mutable-collection>, it must provide or inherit a method for element-setter. A collection that is not a <mutable-collection> must provide an implementation of class-for-copy.

Individual collection classes may impose further requirements on their subclasses. For example, concrete subclasses of <table> must provide or inherit a method for table-protocol.

For efficiency, it may be desirable to provide specialized implementations for certain generic functions. Collections that can implement functions such as size or member? more efficiently should do so. Sequences that can reuse storage to implement functions such as reverse! and sort! should do so.

Next section: Characters