On 2014-12-05 15:27:41 +0000, Steven Schveighoffer said:

On 12/4/14 4:24 AM, 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.

Can we take a step back here?

I read many people's comments and I understand only about half of them.

Can someone who knows what this new feature is supposed to do give some Ali Çehreli-like description on the feature? Basically, let's strip out the *proof* in the DIP (the how it works and why we have it), and focus on how it is to be used.

I still am having a hard time wrapping my head around the benefits and when to use scope, scope ref, why I would use it. I'm worried that we are adding all this complication and it will confuse the shit out of users, to the point where they won't use it.

-Steve

This is exactly why this feature should be default behavior with compiler warnings generated when things escape scope.

The basic idea is that most things should be on the stack and go away when the stack goes away. The proposal codifies how the compiler should infer that references to variables which are to be placed on the stack are not escaping their scope. The benefit is that the GC has to do *way* less work from what it has to do now for most of the use cases of D.

-Shammah

Reply via email to