Please support shorter constructor init
Nick Treleaven
nick at geany.org
Sat Jul 8 19:57:55 UTC 2023
On Saturday, 8 July 2023 at 15:58:57 UTC, ryuukk_ wrote:
> On Saturday, 8 July 2023 at 15:33:34 UTC, Danilo Krahn wrote:
>> On Saturday, 8 July 2023 at 14:52:34 UTC, ryuukk_ wrote:
>>>
>>> Constructor on structs?
>>>
>>> Vectors as classes with inheritance?
>>>
>>> Sorry, but this is just bad advice that nobody should follow
It's not advice. It's explaining what the example code means with
the new feature.
> nobody should use constructor on structs
That's the first time I've ever heard that.
https://dlang.org/phobos/std_typecons.html#.Nullable.this
https://dlang.org/phobos/std_typecons.html#.Tuple.this
https://dlang.org/phobos/std_typecons.html#.Unique.this
> and nobody should use classes for basic stuffs that should be
> simple pod
What if you want a vector reference type on the heap, e.g. for
immutable vectors to share across threads? `new Struct` would
return a pointer, so `+=` won't work. Or if you want it to be
`synchronized`?
More information about the Digitalmars-d
mailing list