"Shin" <> writes:
> Would it be good to allow me to write either:
>
> <cond> ? <code1> : <code2>
>
> or
>
> if(<cond>) then <code1> else <code2>
>
> without forcing me to commit to which context this piece of code will
> appear: i.e., expression or statement.
No. It depends on what <code1> and <code2> are. If they are statements,
then you must use "if", and *should* know that it's the only reasonable
context. If they are expressions, and their values are relevant, then
you should us "?:".
The contents of the branches determines the context, and you should
know what they are.
> Normally you will choose one or the other, but when you generate code,
> sometimes you just don't know.
If you don't know when you generate the code, when will you know?
> Now I miss functional lang.
.... which is easier only because everything is an expression.
/L
--
Lasse Reichstein Nielsen -
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'