On Mon, Jul 30, 2001 at 08:23:12PM -0500, David L. Nicol wrote:
> raptor wrote:
> > 
> > hi,
> > 
> > we have <=> and 'cmp' operators but we don't have the conditional constroct
> > to use better their result :
> > May be forthcomming switch will solve this in some way, but isn't it better
> > to have shortcut like this :
> > 
> > if (cond)
> > { }
> > else {}
> > otherwise {}
> > 
> > i.e.
> > if cond == 1  then  'then-block'
> > if cond == 0  then  'else-block'
> > if cond == -1  then  'otherwise-block'
> > 
> > If the "if" construct doesn't have "otherwise" it behave like the current
> > "if-else"..
> 
> Just as any tree can be represented as a binary tree, any switch
> can be represented as a series of binary switches.  In fact given current
> technology it must be so represented.
> 
> So what you're talking about is a rewriting macro, you want to define
> a syntax 
>       raptorif($&&&)
> and have the language work out the details.
> 
> Sounds okay to me; I wouldn't want to overload "if" in this way though.
> Maybe call it "if3"
> 
>       print do {
>               if3($A cmp $B){
>                       "They're the same"
>               }{
>                       "$A is before $B"       
>               }{
>                       "$B is before $A"
>       }       };
> 
> 
> I am reminded of the conditionals in TeX -- I think there is
> a three-lambda if that works this way -- not sure
> :)

guys... this idea should die a horrible death. It pretty much falls under the 
'??' idea (which had far more merit than this IMO) which TOO died a horrid 
death.

Ed

Reply via email to