On 18 March 2012 04:14, F i L
<witte2008@gmail.com> wrote:
Manu wrote:
That's no less ugly though, in fact, it's considerably more ugly. more
brace spam + indentation levels for nothing.
I actually like the bracket+indentation as a section separator indicator. Usually I'll "group" fields/methods by common attribute:
class Window
{
private {
string _title;
int _x, _y;
// etc...
}
@property {
auto title() { return _title; }
auto x() { return _x; }
auto y() { return _y; }
// etc...
}
}
// Or...
struct Vector2(T)
{
T x, y;
@property {
auto xy() { return this; }
auto yx() { return Vector2(y, x); }
}
@property static {
auto zero() { return Vector2(0, 0); }
auto one() { return Vector2(1, 1); }
// etc...
}
}
But I'm also use to C# code which is usually indented twice before you even get to functions (namespace -> class -> method).
Yeah, I'm not really into that. I group things conceptually.
Either way, I've never written a class where non-virtuals don't outweigh virtuals in the realm of 20:1. There needs to be a way to declare it the other way around without polluting my indentation levels.
final: at the top and explicit 'virtual' would make a big difference.