dip1000 and preview in combine to cause extra safety errors
Dennis
dkorpel at gmail.com
Tue Jun 14 10:52:25 UTC 2022
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](https://github.com/dlang/phobos/pull/8116/files) 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.
More information about the Digitalmars-d
mailing list