Please remove ?:

Stewart Gordon smjg_1998 at yahoo.com
Tue Jun 6 05:34:10 PDT 2006


Lionello Lunesu wrote:
> Stewart Gordon wrote:
<snip>
>> Useless?  I've put it to plenty of use.  So have many C programmers, 
>> some of which have moved on to D.
> 
> ??? I've multiple inheritance to use, "so have many C++ programmers, 
> some of which have moved to D."

?: is a much simpler feature to implement than MI.

> By useless I meant that it can be replaced by if/else, so it does not 
> fill in a void.

Consider a case where a more complicated expression may have a ?: 
expression within it.  Then can you think of a way of writing it instead 
that's nearly as concise?

>> Slow?  I'm surprised.  Do you have a benchmark?
> 
> Just as slow as if/else:
<snip>

Then why not remove if/else because it's slow?

Moreover, language features are not "slow".  What may be slow, however, 
is the code generated by a particular compiler to implement a particular 
  language feature.

Stewart.



More information about the Digitalmars-d mailing list