C-Style Declarations in D
April 1st, 2006 | by Aldacron |There’s a thread in the digitalmars.d.D NG right now regarding support for c-style declarations in D. A small number of people are asking for it to be deprecated. Walter’s take is that it adds very little overhead to the parser, makes porting C apps easier for some people, so if you don’t like it don’t use it. In this argument, I’m on Walter’s side.
The arguments for removing it have been pretty weak - basically that it’s ugly and it complicates the language syntax. Walter already shot down the second argument (very little parser overhead). And really, who cares if it’s ugly? Is one of D’s design goals to be the most syntactically beautiful languages out there (whatever that means)?
If I were to make an argument against it I would point out one of the major complaints people have with C++ - it supports too many paradigms. While some people find this a strength, others find it a flaw. By supporting multiple paradigms you make code maintenance and readability complicated, and the language becomes more difficult to master. D already supports multiple paradigms (procedural programming, object oriented programming, generics/meta programming). While support for c-style declarations doesn’t really constitute a paradigm, supporting them serves to potentially make reading and maintaining D code a bit more complex just because it makes more than one way to make the same declaraion. This is particularly problematic for people who don’t have a C background. But considering how often we have to work with legacy C code in D anyway, I don’t see that it’s a major issue.
I generally don’t chime in on threads like that one, but if you feel strongly about the issue one way or the other, you might want to speak up in the thread (titled C-Style declarations, are they here to stay?!! Walter?).
By Lars Ivar Igesund on Apr 2, 2006
Hi Mike
If you’d like to make a link, you’ll find it and it’s constituent parts at http://larsivi.net
I don’t know if you’ve noticed, but I’ve made a D blog too, and I had to comment on the C-style arrays too
Oh, I more or less disagree on your conclusions
By Aldacron on Apr 5, 2006
Thanks for the heads up. I’ll add you to the sidebar