RE: [sv-bc] [Fwd: Issues with IEEE 1364-2005]

From: Steven Sharp <sharp_at_.....>
Date: Sat Aug 12 2006 - 13:59:50 PDT
>Greg Jaxon pointed out to me that it would be more natural to define
>
>    A ? B   -->   A ?  B : '0
>
>    A ?: B  -->   A ? '1 :  B

If we are playing the abstract language design game, I would have
suggested

     A ? B  -->  A ? B : A
     
     A ?: B -->  A ? A : B
     
In other words, the default is always the same as the condition, rather
than needing a different default for the true and false branches.  It
is a simpler rule, and the logical result comes out the same.  In the
first case, if A is false, then it will select A.  This will give you
false, just like selecting '0.  In the second case, if A is true, then
it will select A.  This will give you true, just like selecting '1.  So
for logical situations, it works just as well.  But it allows other
idioms that are useful, for selecting values rather than just computing
logical conditions.  For example,

  handle = A ?: B ?: C;
  
will give you the first handle that is not null.  And it reads fairly
naturally as "A, unless it is false, in which case B, unless it is false,
in which case C."

But again, while this may be an interesting exercise, I don't think it
is a practical solution to the issue at hand.

Steven Sharp
sharp@cadence.com
Received on Sat Aug 12 13:59:54 2006

This archive was generated by hypermail 2.1.8 : Sat Aug 12 2006 - 14:00:11 PDT