Why can't I give a function's return type the scope storage class?
Olivier FAURE
couteaubleu at gmail.com
Tue Mar 19 19:30:33 UTC 2019
On Tuesday, 19 March 2019 at 10:19:49 UTC, Atila Neves wrote:
> The fact is that DIP1000 didn't prevent me from writing @safe
> code where a pointer dangled. The point of my blog was "how can
> we improve D to disallow anyone else from writing code like
> this by making it fail to compile with -dip1000?". It's got
> nothing to do with C++, the comparison was with Rust, where one
> can't write the faulty code.
Hum, that's a little inaccurate. The part of your code that
creates the dangling is marked as @trusted, which makes...
aaaaand I've been ninja'ed.
But yeah, the problem isn't that -dip1000 allows unsafe code,
it's that there is no way to do what automem does with -dip1000
without using @trusted at some point. Language-level reference
counting could fix that and is on W&A's roadmap, but that's
another can of worms.
More information about the Digitalmars-d
mailing list