Unofficial wish list status.(Jul 2008)

Michel Fortin michel.fortin at michelf.com
Thu Jul 24 17:15:41 PDT 2008


On 2008-07-24 10:21:20 -0400, "Steven Schveighoffer" 
<schveiguy at yahoo.com> said:

> There is no reason you need to define multiple classes.  You are just
> defining more functions that take a different argument type as the 'this'
> pointer.  I don't see why it's so confusing to define those functions in the
> same class as the mutable functions.

You probably never absolutely need two classes, but sometime it would 
help to have a different implementation, and thus different members, 
for a mutable and an invariant version of a class.

For instance, a mutable collection could have additional storage for 
keeping track of the last inserted object, a more complex data 
structure to list some late-bound parts, or perhaps an undo history. 
All of this is usless to the invariant version, but if both are the 
same class you can't escape the additional logic and storage space of 
the mutable one. Thus, the need to make two classes.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list