Remus

Namespace rswhite4 at googlemail.com
Wed Dec 5 11:03:13 PST 2012


On Wednesday, 5 December 2012 at 13:36:14 UTC, renoX wrote:
> On Tuesday, 4 December 2012 at 21:59:15 UTC, Namespace wrote:
> [cut]
>> - readonly variables, even called "lazy const". constant 
>> variable, not rebindable but value must not assign by 
>> declaration. Syntax: readonly int i;
>
> In the (unlikely) case you didn't know: the name for this 
> feature in Eiffel is "once" variable.
>
> BR,
> renoX

Changed. ReadOnly is now Once.
Furthermore I improved the Elvis operator. You can now write:
Foo f;
Foo f2 = f !is null ?: new Foo();
This will be translated to:
Foo f2 = f !is null ? f : new Foo();

Only the valid identifier will be taken.
But take care of this. If you write int[] arr = other_arr.length 
?: [1, 2, 3]; You don't get only 'other_arr', but 
'other_arr.length'. This is because of using member 
functions/propoerties with elvis operators.


More information about the Digitalmars-d-announce mailing list