div0 wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lars T. Kyllingstad wrote:
In D2, what is the effect (if any) of 'scope' in the following situations?

  scope int a;

Nothing

  struct B { ... }
  scope B b;

Nothing, B's destructor will be called even without scope.

  scope int[] c;

c gets deleted when the scope ends. this applies to classes as well.

  // According to the spec, 'in' is shorthand for 'const scope'.
  void foo(in char[] d) { ... }

d is const (read only).
I've no idea why scope is mentioned, it's meaningless in the context
of function arguments.

I think in one of the early, complicated versions of the const system, it meant something. Looks like this mention of it was accidentally left in the spec.

Reply via email to