calling the default ctor static this() removes any such illusion.
----
struct A{
int[]x;
static this(){
x=[1,2,3];
}
}
void main(){
enum a=A.init;
static assert(a is A.init);
}
----
would work under this proposal.
What would be your alternate proposal that would still allow to initialize
x to [1,2,3] in the ctor?



On Fri, May 17, 2013 at 4:46 PM, Igor Stepanov <[email protected]>wrote:

> When programmer see constructor, he think that it will be evaluated each
> time when he create a new object.
> This code will seem obvious for any C++ coder.
> And this coder will be deceived.
>
> If we'll add default constructor to structs, we'll must safe of illusion,
> that constructor is called any time when new object have been created. And
> reject all cases when we can't provide this illusion.
>

Reply via email to