Please remove ?:

Lionello Lunesu lionello at lunesu.remove.com
Sat Jun 3 00:50:41 PDT 2006


"pragma" <pragma_member at pathlink.com> wrote in message 
news:e5pr7d$1jmt$1 at digitaldaemon.com...
> Being more direct and to the point leads to more readable and thus 
> maintainable
> code.  Its really a good thing to have, provided its used responsibly (as 
> with
> all of D's language constructs).

It's true that if you want to write unreadable code, you can do so no matter 
what, and there's little the grammar can do to prevent that.

>> D should be RISC :)
>
> In principle, this is a grand idea.  It means easy compiler construction, 
> and an
> easy to understand language format.  Everybody wins, and there's no more 
> debate
> on what gets added to the language since simple is king - if anything, 
> there's
> debate on what should be taken out in favor of a more rudimentary syntax.
>
> In practice it fails miserably*, since coders are *always* in the game of
> creating shortcuts.  This is why we write libraries, adopt design 
> principles
> like encapsulation and OOP, and press for more concise ways to express 
> common
> idioms in the D language itself.  So we choose classes over structs
> w/func-pointers and switch() over elaborate if/else statements where
> appropriate, even though they're functionally equivalent.

(switch() does a table look-up or a binary search, so it really stands on 
its own.)

> So ultimately you have all kinds of functional overlap in D *everywhere*,
> because every bit of overlap is done with some additional features that 
> cover
> yet more use-cases and idioms.  Please understand that I'm not advocating 
> that D
> become this bloated monster mismash of features, but I hold onto the 
> certainty
> that there is a balance point that allows for some healthy redundancy.

I totally agree.

I must admit that my original post was highly emotional. Just thought the 
code that I've encountered should have been illegal to begin with.

I also agree that ?: has its uses, but I wonder if it can be limited to 
select 1 of 2 constants / literals. I mean, could the grammar be changed to 
only allow constants / literals after the ?.

L. 





More information about the Digitalmars-d mailing list