Remus

Namespace rswhite4 at googlemail.com
Wed Nov 21 01:37:06 PST 2012


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?


More information about the Digitalmars-d-announce mailing list