[Rosettacode] D code line length limit

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 7 07:27:11 PDT 2014


On Wed, 07 May 2014 13:39:55 +0000
Meta via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
> Maybe D programmers need to adopt a new convention for
> annotations in the long term. Instead of:
>
> void doSomething(int n) pure @safe @nogc nothrow
> {
> }
>
> We should write:
>
> pure @safe @nogc nothrow
> void doSomething(int n)
> {
> }

My eyes... Oh, how that hurts readibily. Obviously, folks are free to format
their code how they like, but I very much hope that that style never becomes
prevalent. About the only place in a signature that I like to break it up
across lines is with the parameters, and I generally will let the signature
line get to the limit before I will break it up (which in the case of Phobos,
would be 120 characters, since it has a hard limit of 120, and a soft limit of
80 - and functions are one place where I will definitely go passed the soft
limit).

Regardless, formatting code is one are that's always going to be highly
subjective.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list