On Monday, 13 June 2022 at 23:58:26 UTC, Walter Bright wrote:
>I suggest there is little point to permitting it, as good style would expect that a different variable be used for each purpose, rather than "recycling" an existing variable.
I chose the example for its simplicity, not for its good style. The point remains that scope checking has false positives and it does crop up in real code. Look for example at this refactoring that had to be done in Phobos because tempCString deals with pointers to either stack-allocated or heap-allocated memory based on the length of a run-time string.
That being said, I wouldn't be against eventually doing scope checks in @system code as long as there's still some kind of escape hatch.
Permalink
Reply