Would love to override default ctor of struct
Alex
sascha.orlov at gmail.com
Sat Jan 19 11:01:14 UTC 2019
On Saturday, 19 January 2019 at 10:22:11 UTC, Basile B. wrote:
> On Saturday, 19 January 2019 at 10:18:34 UTC, Alex wrote:
>> On Saturday, 19 January 2019 at 10:05:22 UTC, Dru wrote:
>>> What is the idea behind why we can't define default ctor for
>>> structs?
>>>
>>> In current situation I need to "@disable this()"
>>> then define a constructor with dummy arguments (because my
>>> constructor does not need arguments)
>>>
>>> It is a big pain on syntax
>>
>> If your constructor doesn't need any arguments, what is the
>> reason you can't define default values to your members?
>
> I see your point but...
>
> 1. default member values (via initializer) are more like a
> shared this().
Ok. And why this is a problem? I mean, if the sharedness is not
wanted, then, the thread id should go as a constructor parameter,
shouldn't it?
> 2. not everything can be set using member initializer because
> of CTFE limitations.
Hm... ok. But even then, if something does not work in the way it
should because of limitations: What prevents of setting the
parameter inside a function after or on creation? Or, using a
non-default constructor exactly for these params?
More information about the Digitalmars-d
mailing list