On 2012-02-05 16:25:33 +0000, Jose Armando Garcia <[email protected]> said:
On Sun, Feb 5, 2012 at 2:13 PM, Andrei Alexandrescu
<[email protected]> wrote:
Make it a function.
I agree that in theory that you can do all this stuff in D but the
reality is that developers are lazy and end up fighting the language.
Make it a function literal:
immutable variable = {
if (boolean_condition)
return 1
else
return 2;
}();
The extra () at the end calls the literal immediately so that variable
is assigned the result.
--
Michel Fortin
[email protected]
http://michelf.com/