Hmm - about manifest/enum

Walter Bright newshound1 at digitalmars.com
Tue Jan 1 02:10:48 PST 2008


Janice Caron wrote:
> On 12/31/07, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>> Except in the case of class references, right?  I find this to be the most
>> unacceptable ommision.
> 
> But when are you /ever/ going to need such a thing in a real-life use
> case, that you couldn't just code differently?

Going through the thought process, I finally realized that a true 
reference type (which is what classes are) should look to the user like 
a value type, i.e. the reference part should not be separable from the 
value.

> I thought that ommission was bad at first too, until I thought it
> through. But Walter's right - its absence doesn't present any real
> programming problems. There's really nothing you can't just do another
> way. By contrast, its presence would really screw up the type system.
> Weighing up the pros and cons, I'd say its better to live with this
> than have to deal with all the complication that
> mutable-ref-to-const-heap-data would entail.

It's interesting how having fully transitive const seems to affect the 
way you code and your notions about coding.



More information about the Digitalmars-d mailing list