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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 17 07:54:27 UTC 2022


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

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
Atila and I discussed this, and we think that it should just be an error for a
pure function to throw its parameters. The rationale is too much existing code
relies on the scope inference, and there is (likely) very little that tries to
throw its parameters.

Therefore, this fix will be both correct and break the least amount of code.

For code that does break, the solution is to make a copy of the parameter, and
throw the copy. This is workable since scope is not transitive.

--


More information about the Digitalmars-d-bugs mailing list