In conclusion, stack allocation must be destroyed
FeepingCreature
feepingcreature at gmail.com
Tue Jul 19 12:01:22 UTC 2022
On Tuesday, 19 July 2022 at 11:54:17 UTC, ryuukk_ wrote:
>
>
> If stack allocation is removed and everything will be heap
> allocated, then it will be the day i get rid of D
>
> If compilers bugs there are, they should be fixed
>
> I don't understand why you even make that suggestion, a
> language without stack allocation can't be taken seriously
Different usecases. To be clear, my take is that things should be
stack allocated exactly iff they are value types. (By preference,
immutable value types.) And heap allocated iff they're reference
types. Arrays are reference types, so they should be heap
allocated. Objects ditto. Simple and predictable. I just don't
see the advantage in cleverly stack allocating arrays; it seems
like an invitation to danger that's not worth the benefit. If you
want a stack allocated fixed-size list, you should use an idiom
that always stack allocates it, but also reliably copies it to
callers and protects it from unintentional mutation. Stack
allocating T[] overloads the abstraction, IMO.
More information about the Digitalmars-d
mailing list