On Thursday, 4 December 2014 at 09:25:11 UTC, Walter Bright wrote:
http://wiki.dlang.org/DIP69
Despite its length, this is a fairly simple proposal. It adds
the missing semantics for the 'scope' storage class in order to
make it possible to pass a reference to a function without it
being possible for it to escape.
This, among other things, makes a ref counting type practical.
It also makes it more practical to use other storage allocation
schemes than garbage collection.
It does not make scope into a type constructor, nor a general
type-annotation system.
It does not provide an ownership system, though it would
complement one.
Thanks a lot of trying to move forward with this. Also glad to
see DIP36 didn't vanish completely useless :P It will take me
some time to provide a detailed response so I'll post a summary
of my impression first.
I recognize and respect your attempt to go for most simple
solution that is still useful in practice. Can't say I am happy
about it but it is better to have something working than awesome
plans that never get implemented. In this context trying to get
most of scope as storage class seems right.
But from existing cases it doesn't seem working good enough. For
example, not being able to represent idiom of `scope ref int
foo(scope ref int x) { return x; }` seems very limiting. There
are also issues that pop up because of missing transitivity.
Maybe this can be fixed within existing proposal, maybe not.
Right now I don't have any strong opinion.
I also don't consider `ref` design as a storage class any kind of
success at all and generally agree with Manu on this topic. At
the same time alternative proposals that make it a qualifier
(like Marc did) do impact existing language much more and this no
small concern.
This won't be easy.