Inner classes - More expressiveness needed
Janice Caron
caron800 at googlemail.com
Thu Oct 25 06:08:24 PDT 2007
I can't call this a bug, because I think it's behaving as documented.
Nonetheless, it seems to be that D could be more expressive. The
following won't compile:
class Outer
{
int n;
class Inner
{
static int f() { return n; }
}
}
The error is:
Error: need 'this' to access member n
The problem is that the word "static" is horribly overused, and
doubles up to mean BOTH "the function does not have a this pointer"
AND "this function does not have an outer pointer".
There seems no way to express "please can my function have an outer
pointer but not a this pointer" (which is what I was trying to
achieve).
There also seems no way to express "please can my function have a this
pointer but not an outer pointer". (I wasn't trying to achieve that,
but it could conceivably be useful).
I wonder if we might find some way of expressing those ideas?
More information about the Digitalmars-d
mailing list