Memory/Allocation attributes for variables

Ola Fosheim Grostad ola.fosheim.grostad at gmail.com
Sun May 30 05:13:45 UTC 2021


On Sunday, 30 May 2021 at 02:18:38 UTC, Elmar wrote:
> Looking at what attributes D provides I definitly see that 
> memory safety related concerns are addressed with existing 
> attributes. But I personally find them rather unintuitive to 
> use or difficult to learn for beginners and not flexible enough 
> (like two different versions of `return ref scope`). As 
> currently defined, those attributes don't annotate destinations 
> of data flow but sources (like function arguments) of data flow.

I agree that D has jumped down the rabbithole in terms of 
usability and function signatures are becoming weirder. The 
reusage of the term "return" is particularly bad.

To a large extent this is the aftermath that comes from changing 
course when it went from D1 to D2. Where simplicity was 
sacrificed and it was opened for more and more complexity. Once a 
language becomes complex, it seems difficult to prevent people 
from adding just-one-more-feature that adds to the complexity. 
Also, since experienced users influence the process most... There 
are nobody to stop it.

The main issue is however not specifying where it allocates, but 
keeping track of it when pointers are put into complex 
datastructures.




More information about the Digitalmars-d mailing list