virtual-by-default rant
Manu
turkeyman at gmail.com
Sat Mar 17 19:24:12 PDT 2012
On 18 March 2012 04:14, F i L <witte2008 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120318/f1131518/attachment.html>
More information about the Digitalmars-d
mailing list