Latest const expansion

Alexander Panek alexander.panek at brainsware.org
Tue Sep 11 10:29:05 PDT 2007


Regan Heath wrote:
> Thoughts?  Too complicated?  :P

It's a tad complicated, but makes sense. More sense - to me - than the 
former const/invariant/final and the upcoming const/invariant 
combinations. At least you summed it up in a way so I understand it. :)

Yet, I have some questions:
--
class A { int i; }

const(*A) a;
--
Do I understand correctly? The variable `a' - as in a reference to an 
instance of `class A' is mutable, but the instance `a' refers to is not? 
(read as: `class A { const { int i; ... } }', just for this instance 
reference) This also means, that you can reference to another instance 
with `a':
--
a = b;
--
Right?

--
const(&A) a;
--
This means, that the reference to the class instance is not mutable, yet 
the actual instance is?

What exactly do `const(T)[]' and `const(T)*' imply? Immutable data, or 
immutable reference/pointer?

.. I think that's it for now. So long, and thanks for the fish.

Best regards,
Alex



More information about the Digitalmars-d mailing list