[phobos] Proposal of StopWatch module

Andrei Alexandrescu andrei at erdani.com
Thu Aug 19 10:06:17 PDT 2010


On 08/19/2010 11:42 AM, SHOO wrote:
> (2010/08/20 0:29), Andrei Alexandrescu wrote:
> It is a destructive change to deprecated scope and needs mass code
> renewal. What of present scope are you dissatisfied with? The evolution
> that expands present scope if possible is the best.
> scope pays the sacrifice and what does get?
>
> I want the page that summarize function/features/modules and reasons
> examining the abolition.

We don't have a formal document yet, though the matter is pretty clear 
to us. Consider:

class X {
    ...
    void method() { ... }
}

void fun() {
   scope x = new X;
   x.method();
}

Now consider what steps you need to make sure that the code is safe. 
Essentially x must not escape the scope of foo(). But x is passed inside 
method() as "this". So the compiler must make sure that method() does 
not escape "this". But then method() may call other functions and pass 
"this" to them, or may not even be available to the compiler at the 
point where scope is used. This is an unsolvable problem without making 
extensive changes to the language.

As I'm sure you know we're trying to help the matter with library-based 
approaches, but leaving straight in the language a feature that is 
impossible to make safe is not admissible. Walter and I agree that scope 
must be abolished.


Andrei


More information about the phobos mailing list