Universal Function Attribute Inference

Quirin Schroll qs.il.paperinik at gmail.com
Thu May 16 17:25:53 UTC 2024


On Wednesday, 28 February 2024 at 17:18:04 UTC, Paul Backus wrote:
> Currently, function attributes and function parameter 
> attributes are only inferred by the D compiler for certain 
> kinds of functions. This DIP idea proposes that such inference 
> be extended to all non-overridable functions with bodies.

Why not just provide a tool or a compiler switch that tells you 
where something should have been annotated, but isn’t?

Something like `-helpAnnotate=safe,system,nogc` and the compiler 
will tell you which functions in your code base could be `@safe` 
and/or `@nogc`, but aren’t annotated `@safe` and/or `@nogc`, and 
which functions are `@system`, but lack the annotation.


More information about the dip.ideas mailing list