Thread overview
Coding style on dlang.org
Aug 23, 2014
H. S. Teoh
Aug 23, 2014
monarch_dodra
Aug 23, 2014
Andrej Mitrovic
Aug 24, 2014
Jonathan M Davis
Aug 26, 2014
H. S. Teoh
Aug 23, 2014
w0rp
Aug 25, 2014
Nordlöw
Aug 25, 2014
Nordlöw
August 23, 2014
I notice that the coding style used for code examples on dlang.org isn't always consistent, and they generally differ from Phobos examples. Should we adopt Phobos style for all code examples on dlang.org?


T

-- 
Real Programmers use "cat > a.out".
August 23, 2014
On Saturday, 23 August 2014 at 14:52:45 UTC, H. S. Teoh via Digitalmars-d wrote:
> I notice that the coding style used for code examples on dlang.org isn't
> always consistent, and they generally differ from Phobos examples.
> Should we adopt Phobos style for all code examples on dlang.org?
>
>
> T

Do you have any specific examples? I'd assume the code is mostly old. I'd reject any pull that doesn't adhere to Phobos style, even if it's just ddoc'ed examples.
August 23, 2014
On Saturday, 23 August 2014 at 14:52:45 UTC, H. S. Teoh via Digitalmars-d wrote:
> I notice that the coding style used for code examples on dlang.org isn't
> always consistent, and they generally differ from Phobos examples.
> Should we adopt Phobos style for all code examples on dlang.org?
>
>
> T

I think I'd recommend submitting pull requests to fix the examples to match current conventions, or making edits to wiki pages.
August 23, 2014
On 8/23/14, H. S. Teoh via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> The "violations" are mainly Egyptian braces, 2-space indentation, and a few missing closing braces.

Most of these come from D1 docs ported to D2, which were originally written by (I believe) Walter. Also, I think the code was meant to be tight and have as less lines as possible, to avoid increasing the size of the page.

But I think if page size is a concern then the page should be split into multiple pages, we shouldn't make code readability suffer.

I think we should use the D style guide for all our samples.
August 24, 2014
On Sat, 23 Aug 2014 21:20:13 +0200
Andrej Mitrovic via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

> I think we should use the D style guide for all our samples.

Agreed.

- Jonathan M Davis

August 25, 2014
On Saturday, 23 August 2014 at 14:52:45 UTC, H. S. Teoh via Digitalmars-d wrote:
> I notice that the coding style used for code examples on dlang.org isn't
> always consistent, and they generally differ from Phobos

How about making use of automatic indentation in this case? Are there any plans to make use of libdparse, Dscanner or DCD to implement this. Hackerpilot?
August 25, 2014
On Monday, 25 August 2014 at 20:22:35 UTC, Nordlöw wrote:
> How about making use of automatic indentation in this case? Are

Of course indentation isn't everything, and perhaps not the most important thing in this case...
August 26, 2014
On Sat, Aug 23, 2014 at 05:09:09PM -0700, Jonathan M Davis via Digitalmars-d wrote:
> On Sat, 23 Aug 2014 21:20:13 +0200
> Andrej Mitrovic via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> 
> > I think we should use the D style guide for all our samples.
> 
> Agreed.
[...]

Alright, the deed is done:

	https://github.com/D-Programming-Language/dlang.org/pull/640

It took a while, but it's all done now. :)


T

-- 
Some ideas are so stupid that only intellectuals could believe them. -- George Orwell