D benchmark code review

Brian Rogoff brogoff at gmail.com
Fri Dec 13 10:20:20 PST 2013


On Friday, 13 December 2013 at 17:30:09 UTC, Manu wrote:
> On 14 December 2013 03:10, Brian Rogoff <brogoff at gmail.com>
>> You've never read TDPL.
>>
>
> Published material, optimised for print. Andrei admits this. He 
> uses C
> braces in his code.

I don't see why 'optimized for print' isn't a strong argument for 
code being read from a terminal or browser or IDE or whatever, 
but I accept that this is a matter of taste.

>
> .. or Ali Cehreli's D tutorial.
>>
>
> Possibly following Andrei's lead, and possible consideration 
> for print?

Or possibly Ali just prefers this style?

> ... or looked at the D Rosetta code examples
>
>
> No, not really. That's a bit sad. I'd make the same argument 
> there if it's
> as you say though.

It is as I say. Also with much of the C++ and Java (as you would 
guess) submissions. I don't find it sad. I find it sadder that 8 
spaces was chosen for the Phobos indentation.

>>  If you were going to publish some Java code using C braces, 
>> how would you
>>> feel about that?
>>>
>>
>> Feel free!
>
>
> You're saying you wouldn't find it unconventional, and perhaps 
> ammateur
> looking?

No, I'm not saying that. I would find it unusual. As I said, I've 
noticed that the publication style indentation is becoming more 
widely used in C and C++ as well. I'm just saying that I've grown 
used to reading many different styles, so I wouldn't assume 
amateurism, but given the code I've been reading and what I said 
above anything that isn't publication style looks a bit unusual 
to me. More so in Java, as you say.

BTW, I like the term 'Egyptian style', but 'publication style' 
more accurately suggests its rationale.

> I only feel strongly about not being ambivalent on the matter. 
> When I write
> Java, I use egyptian braces, and then it looks like Java code. 
> Most people
> seem to understand that that's an expectation in Java. When I 
> write C code,
> I use C braces.
> I think C became widely confused soon after university CS 
> courses started
> teaching Java primarily, then you have inexperienced post-grads 
> bring their
> Java habits into their C code.

I remember discussion of this in C long before Java became 
popular. I learned to just use whatever other programmer's had 
used on any given project. If there is a choice, some people will 
make different choices.

> If D deliberately commits to the 'university post-grad 
> syndrome' principle
> that C has found itself in, then I find that to be sad.
> However, clearly, since there's debate on this, D _has_ already
> inadvertently made that commitment. Oh well.

I don't think it's a university thing. Nor am I suggesting that 
there is debate: the course for Phobos has been charted. What I'm 
suggesting is that the entire D community isn't committed to that 
style. You can enforce it on your own projects, but that's your 
choice.

-- Brian



More information about the Digitalmars-d mailing list