Const initialization issue, looking for solution

Jakob Ovrum jakobovrum at gmail.com
Wed May 29 06:25:25 PDT 2013


On Wednesday, 29 May 2013 at 13:19:34 UTC, deadalnix wrote:
> I guess the first assignment of a variable should be considered 
> as a declaration unless it has been read in between. This is 
> the same problem as immutable constructor, and also relate to 
> extra copies elimination.

Yeah, and languages like C# solve these problems quite 
beautifully. I don't think there's a reason we can't do almost 
the same thing in D, except it requires implementation effort and 
overcoming Walter's protests. Regardless, it's probably not 
something to expect in the short-term.

----
I was unable to leverage std.exception. collectException looks 
promising at first glance - and maybe if the return value and out 
parameter were switched, it would work - but then I suspect the 
function's implementation would face exactly the same problem.


More information about the Digitalmars-d mailing list