On 5/29/13 9:25 AM, Jakob Ovrum wrote:
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.
How does C# solve it?
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.
I must have missed part of this - how would the desired setup work?
Andrei