Remus
Jacob Carlborg
doob at me.com
Wed Nov 21 12:00:16 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?
A property shortcut syntax would be cool to have.
class Foo
{
@property int bar;
}
Lowered to:
class
{
private int bar_;
@property int bar () { return bar_; }
@property int bar (int value) { return bar_ = value; }
}
It would also be nice if you could manually implement any of the getter
or setter and none would be generated in that case.
--
/Jacob Carlborg
More information about the Digitalmars-d-announce
mailing list