[Issue 5007] @outer() attribute
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 6 18:35:04 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5007
Nick Sabalausky <cbkbbejeap at mailinator.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cbkbbejeap at mailinator.com
--- Comment #1 from Nick Sabalausky <cbkbbejeap at mailinator.com> 2010-10-06 18:34:38 PDT ---
I like the general idea, but why specify the globals you're going to use? Why
not something like this:
--------------------
module foo;
int globalVar;
class Foo()
{
int instanceVar;
static int classVar;
@explicitLookup // Name subject to change
void bar()
{
int globalVar; // Error
int instanceVar; // Error
int classVar; // Error
globalVar = 1; // Error
instanceVar = 1; // Error
classVar = 1; // Error
.globalVar = 1; // Ok
this.instanceVar = 1; // Ok
Foo.classVar = 1; // Ok
}
}
--------------------
And, of course, let it also be used like like this:
--------------------
module foo;
@explicitLookup: // Applies to all code below
int globalVar;
class Foo()
{
int instanceVar;
static int classVar;
void bar()
{
globalVar = 1; // Error
instanceVar = 1; // Error
classVar = 1; // Error
.globalVar = 1; // Ok
this.instanceVar = 1; // Ok
Foo.classVar = 1; // Ok
}
}
--------------------
--
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