RE: IfExpr has a mandatory else clause

"Kay, Michael" <[email protected]>
Newsgroups gmane.comp.web.query-languages
Message-ID <[email protected]>
> So is grammar ambiguity the reason that IfExpr has a
> mandatory else clause ? Are there other design considerations 

Making the else clause mandatory emphasizes that this is an expression
and not a procedural statement: it always returns a result. In most
languages where I've seen a conditional expression, both branches are
mandatory.

An exception of course is <xsl:if> in XSLT, but perhaps that's because
the semantics have only recently been recast into expression form, and
the spec still talks of this as an "instruction" rather than an
"expression".

Michael Kay
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.