[Issue 5007] @outer() attribute

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 6 19:24:28 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5007



--- Comment #2 from bearophile_hugs at eml.cc 2010-10-06 19:24:03 PDT ---
(In reply to comment #1)

> but why specify the globals you're going to use?

It's like in Contract Programming, where your contracts state what are the
conditions on the function inputs and outputs (and when the "old" will be
available the contracts will also be able to specify at high level some of the
changes).

The @outer is like a contract that specifies what's the allowed flux of
information in and out of a function. Reducing unwanted and unforeseen flux of
information between subsystems is a very good way to reduce the complexity of
the whole design.

So @outer() is similar to a second signature of the function. Beside the normal
signature that states the types and in/out/ref nature of the explicit function
arguments, the @outer() allows to specify the names and in/out/ref nature of
the implicit (== from outer scopes) names used by the function.


>         this.instanceVar = 1; // Ok

Many programmers don't like this (despite it's the way Python code is written).


>         Foo.classVar     = 1; // Ok

The need to prefix static members with the class/struct name is something I'd
like to be enforced on default.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list