Is @safe still a work-in-progress?

Jonathan M Davis newsgroup.d at jmdavisprog.com
Mon Aug 20 14:28:53 UTC 2018


On Monday, August 20, 2018 7:46:48 AM MDT Steven Schveighoffer via 
Digitalmars-d wrote:
> I would, but I have no idea how dip1000 is supposed to work. I think
> only you understand it. Even looking at the PR that you have been citing
> over and over, I can't make heads or tails of what it does or what it
> allows.

The basic idea of DIP 1000 seems simple enough, but once you get into the
details, it gets hard to understand fast.

And from what work I've done to make std.datetime work with it better, I'm
very much inclined to think that it's just too intrusive for too little
gain. I mean, it's great that you can know that a pointer isn't going to
escape, but once you have to start marking up member functions all over the
place just so that the type can work with scope? It just seems like it's too
viral. I honestly do not understand why much of anything in
std.datetime.systime needs scope, but I was forced to mark up SysTime all
over the place in order for scope variables of type SysTime to work just
because it contains a class reference - one which cannot posssibly ever be
on the stack, since you can't pass a scope argument to a member function to
have it then stored in a member variable. So, why it has any effect on why
scope is required on member functions, I have no idea.

User-defined types can't contain anything that's scope (since that would
mean that they escaped), and yet, they potentially have to be marked up with
scope all over the place in case someone qualifies a variable of that type
with scope somewhere. And of course, because of how stuff like ranges work,
you're quickly in trouble if they're marked with scope, since then they
can't be wrapped by other ranges, making them useless for pretty much
anything other than foreach. scope seems great for toy examples or stuff
that's extern(C), but once user-defined types get involved, it's a mess.

I've got partially completed changes to std.datetime.interval towards making
it work with scope better that I need to get back to, but to be honest, the
more I've tried to do anything with -dip1000, the less I've like it, and
it's really hard to be motivated to go to the effort of making anything
compatible with it.

- Jonathan M Davis





More information about the Digitalmars-d mailing list