Remus

Jacob Carlborg doob at me.com
Wed Nov 21 05:08:41 PST 2012


On 2012-11-21 10:37, Namespace wrote:
> After some consideration, I now have the following things, which I wish
> that D would have them built-in:
>   - scope arrays: like static arrays, but you can init them at runtime
> with constant and non-constant expressions and they are resizeable if
> you have to. They will (so far) allocated on the heap and will released
> at the end of the lifetime of the scope. Furthermore you _can_ reserve
> memory, but by default the length and the capacity of the array are
> equal. Means: you don't pay (by default) for memory which you don't
> need. Syntax idea: 'scope int[5] arr;' and 'scope int[some_runtime_int]
> arr;'
>   - lazy const: Just a spontaneous idea: I have often variables, which
> aren't initialize in the CTor, but they are initialized only once, and
> then they should be constant. That isn't possible yet. Therefore I whish
> something like: lazy const var;
>   - And of course: not-null references. There is not much to say.
> Current syntax idea comes from C++: Foo& f = other_f;
>
> So what do you mean about these ideas? And if you like one, what do you
> mean about the syntax?

Is this in addition to what you had previously or is that removed?

In addition to this, how about "final" variables, or something similar.

final Foo foo = new Foo;

It's not possible to reassign a "final" variable but you can call any 
method on it, not just const/immutable methods.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list