Hmm - about manifest/enum

Steven Schveighoffer schveiguy at yahoo.com
Wed Jan 2 10:26:42 PST 2008


"Dan" wrote
> Whether the language caters to every possible convenience need is 
> irrelevant granted you can eventually accomplish any given program. 
> Const-ness is a convenience for the compiler, not a requirement to 
> accomplish *any* given program.
>

Unfortunately, it is a requirement if you intend to use someone's library 
which uses const (such as Phobos).

> In my opinion it is quite acceptable that classes are treated differently 
> in this respect, because classes are treated differently in many other 
> parts of D already.  They're simply inherently, internally different in 
> enough ways that to make it seemless would be to over-abstract the 
> language.

I don't mind classes being treated different than structs.  I believe the 
way classes and structs differ is fine.  My issue is with class references.

>
> There are many many many cases of classes having distinct advantages or 
> disadvantages to structs.  Let this be another.

There is no good reason anyone has ever given as to why we cannot have 
mutable class references to const class data.  Nobody.  In fact, Walter had 
originally had this implemented, but I think the way he did it made other 
things confusing.  I believe there is a way to do it that is not confusing, 
and allows for everyone to have what they want.  So with no good reason why 
it cannot be done, and since Walter has already done it before, why not 
allow it?  The workarounds given are hacks at best.

-Steve 





More information about the Digitalmars-d mailing list