Le 18/06/2012 17:28, Mehrdad a écrit :
On Monday, 18 June 2012 at 15:24:31 UTC, Mehrdad wrote:
On Monday, 18 June 2012 at 15:21:36 UTC, Timon Gehr wrote:
So (**IMHO**) if that's really the case, we should really spend some
time fixing the /design/ of const before the implementation...
This is mostly about the design of object initialisation.
good idea or no?
Certainly.
My initial instinct would be to require a "const constructor" in order
for an object to be const-able, but I'm not sure if that would work
correctly or not..
Come to think of it, that would play REALLY nicely with 'scope' -- a
reference to a non-const object can be escaped from a 'const
constructor' if and only if the reference is scope!
Bingo! Does that work??
Indeed, this should be scope for ctor (avoid partially initialized
object in 3rd party code) /dtor (avoid resurrection, which is a real
pain for any GC, and a very good way to ends up with alive object in
invalid state).