Re: IfExpr has a mandatory else clause

Torsten Grust <[email protected]>
Newsgroups gmane.comp.web.query-languages
Message-ID <[email protected]>
G'day all,

  grammar issues aside for a minute, I perceive XQuery as a
_functional_ query language.  The IfExpr thus constitutes a
conditional expression rather than a control flow construct (like in
procedural programming languages).

As a conditional expression, IfExpr is required to evaluate to a
well-defined value, regardless of the outcome of the tested
condition.  This is why I find it quite natural that the `else' clause
is mandatory.  What would be the value of an IfExpr in case the
conditition evaluates to false?

Greetings,
   --Torsten

On January 26 (17:49 +0800), TAN Kuan Hui wrote with possible
deletions:
|
| Syntactically seems to parse but will this cause confusion ?
| Using () instead of {} will also re-introduce the
| ambiguity with an optional else clause although distinguishable.
|
| So is grammar ambiguity the reason that IfExpr has a
| mandatory else clause ? Are there other design considerations ?
| Appreciate any clarification.



--
  | Dr. Torsten Grust                          [email protected] |
  |                                   http://www.inf.uni-konstanz.de/~grust/ |
  | Database Research Group, University of Konstanz (Lake Constance/Germany) |
  |             (Please avoid sending me MS Word or PowerPoint attachments.) |
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.