A little of coordination for Rosettacode

bearophile bearophileHUGS at lycos.com
Tue Feb 12 09:58:55 PST 2013


ixid:

> If you're posting code on Rosetta code you are presenting that 
> code as idiomatic.

The D code on Rosettacode has some stylistic uniformity, and I 
think in most cases it follows the dstyle 
(http://dlang.org/dstyle.html ), but that code is not meant to be 
"production code" (lot of people in other languages don't add 
unittests, etc). So it is not idiomatic, and it's not meant to 
be. If you go on Rosettacode you can't expect to see code similar 
to Phobos code.

There is also variability: some D entries of Rosettacode have 
unittests and are written in a readable style, other entries try 
to be short simple, and other entries are very strongly typed and 
longer, other entries look almost as C, and so on. This is done 
on purpose, to show various kinds of D coding. None of those ways 
is the only idiomatic one.


> You tend to use the superfluous parens which the properties 
> discussion would suggest are becoming more idiomatic not to use.

-property was supposed to become the standard semantics of the D 
language. So I have written code that way. Later things are 
changing. Now I am waiting to see what's coming out of the 
property discussion. If the final decision is that those 
parentheses aren't needed nor idiomatic, I/we will (slowly) 
remove the parentheses from the entries.


> You also use 'in' a lot in function inputs while others have 
> argued against it.

"in" is currently not good if you are writing a long term large 
library, or a larger program you want to use for lot of time, 
etc, because it assumes some type system semantics that is not 
yet implemented.
But for the purposes of Rosettacode using "in" is good, because 
it's short, readable, and if/when scope will break some entries, 
I/we will fix them.


> This is not an attack on your code at all, but maybe there 
> should be some discussion of and consensus on what is idiomatic.

One problem of Rosettacode is that it's not so good to discuss. 
GitHub offers better means to discuss on the code.

What other things do you want to discuss about?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list