What to do when you want to add attributes to your class functions?

Adam D Ruppe destructionator at gmail.com
Fri Sep 16 13:13:49 UTC 2022


On Friday, 16 September 2022 at 13:02:44 UTC, RazvanN wrote:
> what if in the future we could make them @safe
> We create yet another overload?

Yes. You'll probably want to think it through to try to get it 
right the first time (and not add new attributes to the language 
without good reason).

You are publishing an interface with certain restrictions. You 
need to decide what those restrictions are or be willing to make 
breaking changes.

In this case, I really do think the breaking change is the right 
thing to do. Quite unlikely the addition of `@nogc` here will 
*actually* break anything - a search of the dub code might be 
able to give stronger evidence for this too. But changing an 
exception to a different mechanism, including a different 
allocation, might break things in practice so i really expect 
that's where you should be focusing...


More information about the Digitalmars-d mailing list