Had another 48hr game jam this weekend...

Gary Willoughby dev at nomad.so
Sun Sep 1 13:16:13 PDT 2013


On Sunday, 1 September 2013 at 14:37:13 UTC, Manu wrote:
> On 1 September 2013 20:22, Gary Willoughby <dev at nomad.so> wrote:
>
>> On Sunday, 1 September 2013 at 02:05:51 UTC, Manu wrote:
>>
>>> We all wanted to ability to define class member functions 
>>> outside the
>>> class
>>> definition:
>>>   class MyClass
>>>   {
>>>     void method();
>>>   }
>>>
>>>   void MyClass.method()
>>>   {
>>>     //...
>>>   }
>>>
>>> It definitely cost us time simply trying to understand the 
>>> class layout
>>> visually (ie, when IDE support is barely available).
>>> You don't need to see the function bodies in the class 
>>> definition, you
>>> want
>>> to quickly see what a class has and does.
>>>
>>
>> Uggh! I absolutely do not agree with this. You should rely on
>> documentation or an IDE class overview for these things *not* 
>> alter the
>> language. In lieu of IDE support just use ddoc comments for 
>> methods and
>> properties and compile the documentation for each build.
>>
>
> I think that's unrealistic. People need to read the code in a 
> variety of
> places. Github commit logs (limited horizontal space), 
> diff/merge clients,
> office communication/chat tools.
> If the code depends on an IDE to be readable, then that's gotta 
> be
> considered an epic fail!
>
> Give me one advantage to defining methods inline? I only see 
> disadvantages.
> Lots of them.

That's because you're suggesting that if we can't get an 
immediate overview of class code then it's unreadable which is 
complete nonsense. Classes do sometimes grow and become large and 
getting an overview is hard but that doesn't mean the code is 
unreadable or of low quality. In fact if the developers have 
bothered to write the associated ddoc comments while developing 
the code, creating overviews is as trivial as adding -D to the 
compile command.

An overview of the class's interface should be the job of the 
documentation or a nice tool such as DDOC, an IDE class overview 
(there are many), class diagrams, ctags, etc...

IMHO it's total folly to further complicate the language to 
provide you with something that already exists and i think this 
particular point is just because of your personal preference on 
how code should be structured which is obviously drawn from C++.


More information about the Digitalmars-d mailing list