Had another 48hr game jam this weekend...

bearophile bearophileHUGS at lycos.com
Sun Sep 1 20:42:07 PDT 2013


Nick Sabalausky:

> This isn't Python, nobody *has* to indent it.

In Phobos not/badly indented code is going to receive a patch to
fix it and indent it correctly.
In my code I try to respect indentations as much as in Python. I
am not happy to read D code written by other people that has
no/bad indentations.

---------------

Manu:

> Except that you can _read the class definition_.

That's not the right way/place to read the class definition.

(You have a habit coming from C++, but if you want to program in D
you have to rewire your brain a little, to adapt yourself to the
D style).

---------------

Walter:

>> Andrei and I talked about this a while back, and we both think 
>> it is a good idea.

Why do you think it's a good idea? Why you don't think tools or
ddoc output is the right place for that?

Where do I find an automatic tool to convert the Manu-style class
code back the less noisy original D-style? :-)

---------------

Manu:

> We are used to
> being able to gather a quick summary of a class at a glance.

I think you have to get used to the D style a little more.


> D (or perhaps just me) makes extensive use of local functions. 
> If the outer
> function is at the leftmost tab level, it's easy to recognise 
> if you're
> reading the code from a local function or not. If the outer 
> function is
> already a few tab levels deep, I frequently find myself 
> becoming unsure of what/where I'm actually reading.

Break methods in smaller functions with less indenting. When
indenting starts to be hard to tell apart, then it's often a sign
that you have too many.

Bye,
bearophile


More information about the Digitalmars-d mailing list