DIP10005: Dependency-Carrying Declarations is now available for community feedback

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Dec 18 05:38:52 PST 2016


On 12/18/16 6:47 AM, Jacob Carlborg wrote:
> On 2016-12-18 01:34, Andrei Alexandrescu wrote:
>
>> Yeah, std/datetime.d is a monster, from what I can tell owing to a rote
>> and redundant way of handling unittesting. I didn't look at its
>> dependencies, but I doubt they are special. I was quite vocal about
>> breaking it up, but I got mellower with time since (a) someone measured
>> its size without unittests and it was something like one order of
>> magnitude smaller, and (b) there was really no more trouble using or
>> maintaining it than with anything else in Phobos.
>
> Most other languages don't have inline unit tests, which saves a lot of
> lines of code.

How does the lack of the feature save lines? Doesn't it just move them 
elsewhere?

> Not sure if this is the case. But if we have unit tests that are more on
> the functional/integration side perhaps those should be moved to a
> separate file structure.
>
>> I should also add that each large project has a couple of outliers like
>> that. I even recall a switch of a couple thousand lines once :o).
>
> Just because another project is worse doesn't mean we're in a good
> position.

The point was just that it's par for the course.

> Rubocop, the major linter in the Ruby world, will complain if a class is
> more than 100 lines of code.

Does that include full documentation and unittests?

> I think that is on the extreme side but I
> think any module with more than 2000 lines of code is too big.

Phobos' average file size 2055 is lines and median file size is 903 
lines. Do you find these appropriate for your preferences, considering 
this size includes documentation and unittests? Would you find it 
helpful to use a tool that collapses these?


Andrei



More information about the Digitalmars-d mailing list