Eigenpoll : D wish list : void Class.Method() {} syntax 

Currently, writing a class with methods looks like this:

class Foo
{
protected int answer;

void bar()
{
/* We're far out to the right. */
answer = 42;
}

int baz()
{
return answer;
}
}

I would prefer this:

/* Put variables here */
class Foo
{
protected int answer;
}

/* This screams which class you're adding the method to. I like it. */
void Foo.bar()
{
answer = 42;
}

int Foo.baz()
{
return answer;
}

Why? It saves one indent. If this syntax would be added, I think both styles should be allowed and acceptable.

I think the current style has one indent too much, wasting screen space, plus I like how my suggestion would remind you of which class the method belongs to.

Report this item for cleanup