Universal Function Attribute Inference

Dom DiSc dominikus at scherkl.de
Fri Apr 5 09:57:32 UTC 2024


On Thursday, 29 February 2024 at 22:39:43 UTC, Paul Backus wrote:
> On Thursday, 29 February 2024 at 21:21:12 UTC, Sebastiaan Koppe 
> wrote:
>> What about only doing inference when something fails to 
>> compile due to a missing attribute?
>
> This would completely break separate compilation,

Isn't that already broken? See Bugzilla Issue #17541
https://forum.dlang.org/post/gguwkjyiduyxjilyluvf@forum.dlang.org#:~:text=%3A%20Bugzilla%20Issue%20%2317541

It seems inference need to spend more time to find out if some 
attribute can really be added and not give up early - else there 
will be always cases where an attribute is expected but was not 
inferred. Maybe the compiler should even warn, if it is not sure 
if some attribute is fulfilled or not? Something like: "purity 
could not be inferred. Please explicitly state if this function 
is pure or not"
(of course that would require the counterparts of pure, @nogc and 
@nothrow)



More information about the dip.ideas mailing list