> How difficult would it be to implement the (ternary?) "? :" operator in
> Unicon? It could be pretty handy in some situations, especially for C
> lovers :-)
Since "if E1 then E2 else E3" is already an expression in Unicon, it is
already a suitable replacement for the C ternary (? :) operator. Note
that I can say things like
s := if \x then "hello" else "goodbye"
A reasonable question is whether it is important to provide a shorter
(operator) notation for this construct, and (for C lovers) why can't
we provide the C ternary operator as it is?
It turns out Icon has an e1 ? e2 operator (string scanning).
Adding an (e1 ? e2 : e3) syntax to the YACC grammar would not
break anything (it adds a shift-reduce conflict, no big deal).
But I am not sure I am comfortable with a proposal for e1 ? e2 : e3
to have a semantics that are completely unrelated to e1 ? e2
So you may have to live with "if-then-else" syntax in Unicon, and
if you like the other, you should look at the Godiva language, which
is vaporware, but at least aspires to a more C-based syntax. :-)
Clint
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group