www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Coding style on dlang.org

reply "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> writes:
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".
Aug 23 2014
next sibling parent "monarch_dodra" <monarchdodra gmail.com> writes:
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.
Aug 23 2014
prev sibling next sibling parent reply "w0rp" <devw0rp gmail.com> writes:
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.
Aug 23 2014
next sibling parent Andrej Mitrovic via Digitalmars-d <digitalmars-d puremagic.com> writes:
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.
Aug 23 2014
prev sibling next sibling parent Jonathan M Davis via Digitalmars-d <digitalmars-d puremagic.com> writes:
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
Aug 23 2014
prev sibling parent "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> writes:
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
Aug 26 2014
prev sibling next sibling parent "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> writes:
On Sat, Aug 23, 2014 at 03:01:59PM +0000, monarch_dodra via Digitalmars-d wrote:
 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?
[...]
 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.
Plenty. Just a few random examples: http://dlang.org/abi.html http://dlang.org/arrays.html http://dlang.org/attributes.html http://dlang.org/class.html http://dlang.org/index.html (!) The "violations" are mainly Egyptian braces, 2-space indentation, and a few missing closing braces. On Sat, Aug 23, 2014 at 03:41:03PM +0000, w0rp via Digitalmars-d wrote: [...]
 I think I'd recommend submitting pull requests to fix the examples to
 match current conventions, or making edits to wiki pages.
I'm working on a dlang.org PR to fix the code examples. Still debating whether to submit them as separate PR's, or a single giant PR (esp. since I'm moving this week so won't have much time to work on this!). T -- I am a consultant. My job is to make your job redundant. -- Mr Tom
Aug 23 2014
prev sibling parent reply =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
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?
Aug 25 2014
parent =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
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...
Aug 25 2014