Had another 48hr game jam this weekend...

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Sep 2 09:39:08 PDT 2013


On 9/1/13 11:52 AM, Andrej Mitrovic wrote:
> On 9/1/13, Manu <turkeyman at gmail.com> wrote:
>> Perhaps the dev's here use relatively few, or very simple classes?
>
> I think it's the latter. Plus we have UFCS, so we don't necessarily
> have to define everything as a member function. Also remember that D
> isn't so reliant on classes for "polymorphic" behavior, we have
> templates. All of this contributes to much fewer uses of classes than
> in, say, C#.
>
>> And why would you want to indent every line of function code by a few tabs?
>
> I think this is a result of not being able to define the methods
> outside of the class. You still want a visual clue that they're member
> functions, so you indent them. Otherwise I'd personally love to be
> able to define the methods outside.
>
> Btw, I found Andrei's post where he proposes your suggestion:
>
> http://forum.dlang.org/thread/j0cs8r$mch$1@digitalmars.com#post-j0cs8r:24mch:241:40digitalmars.com
>
> At #1 is:
> 1. The compiler shall accept method definitions outside a class.

I still think there's value in accepting that, and IMHO it's a 
no-brainer requirement if hand-written .di files are to be used 
systematically. The argument for all-in-one classes is less duplication 
of signatures. Our current approach makes for _more_ duplication in 
projects using hand-written .di files because the duplication includes 
class state.

Andrei



More information about the Digitalmars-d mailing list