[Issue 22221] [dip1000] pure function can escape parameters through Exception

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 14 13:36:39 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22221

--- Comment #8 from Dennis <dkorpel at live.nl> ---
(In reply to Atila Neves from comment #7)
> > The compiler thinks "`scope` inference failed
> 
> On a non templated function?

I assume a function with attribute inference here, but it's the same without
inference. The point is: the language doesn't define `pure` to imply `scope` in
any way, neither is this expected behavior.

> With a comment on enforce. It's not ideal, but I think it's better than the
> current situation.

What about attribute inference becoming intractable like I mentioned?

> > If you want to mark the function as "pure but don't scope my params", then mark it > `pure` and add `scope` to the parameters.
> 
> That doesn't make any sense to me. What we want is to rely on inference as
> much as possible instead of explicit `scope` on parameters.

I meant "mark it `pure` and *don't* add `scope` parameters". The point here is:
non-scope is the default, there's no need for a `nonscope` keyword or
workaround when you don't introduce a special case where `scope` becomes the
default.

--


More information about the Digitalmars-d-bugs mailing list