On 05/23/2013 08:41 AM, Steven Schveighoffer wrote:

> The immutability should be applied on the first read of the
> member,

Makes sense to me.

Not exactly the same issue but here is a related past discussion:

  http://forum.dlang.org/thread/khu6tl$q8o$1...@digitalmars.com

Quoting deadalnix:

"Yes, in general, first assignment in a constructor should be
considered as a declaration if the value is not read before.

This allow for the mentioned optimization, but many very other
important stuff as well, like the construction of immutable
objects."

And the enhancement request:

  http://d.puremagic.com/issues/show_bug.cgi?id=9732

Ali

Reply via email to