Dlist and dip1000 challenge
Walter Bright
newshound2 at digitalmars.com
Thu Oct 25 20:37:55 UTC 2018
On 10/25/2018 6:50 AM, Steven Schveighoffer wrote:
> I know this debate is continuing. But that PR has nothing to do with the problem
> I'm having (what this post is really about). I'm not returning anything via the
> first parameter. Just for kicks, I downloaded your PR branch, and it still has
> the same problem with somehow assuming something is scope. So can you address
> this problem at all?
The problems people have with DIP1000 nearly always stem from the code being
complicated. The code example you posted is quite complicated with a lot of
moving parts. The only way to get a handle on what is happening is to break it
down into small, and I mean small, chunks.
The trick to finding out why a chunk of code is being inferred as not @safe is
to mark it @safe and thereby see where the error is.
Some designs are unworkable with scope without some unsafe casting. A linked
list may be one of them (I believe the same holds for linked lists in Rust, but
I'm not sure if I remember that correctly).
And lastly, I've done this with Phobos. Phobos is absurdly and ridiculously
tangled code with layers and layers and layers of templates that all just
forward to yet another template. It makes it pretty hard to track down DIP1000
errors. DIP1000 is not terribly usable when Phobos can't be built with DIP1000,
and that requires the PR to make progress on that.
Therefore DIP1000 is pretty dead in the water without the PR.
More information about the Digitalmars-d
mailing list