[Bug 29263] New: if expression: optional else branch?

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29263

            Bug ID: 29263
           Summary: if expression: optional else branch?
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 3.1
          Assignee: jonathan.robie@gmail.com
          Reporter: christian.gruen@gmail.com
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

Over the years, I have seen hundreds of XQuery code snippets in which the else
branch of the if expression was an empty sequence:

  if(...) then ... else ()

Besides that, people seem to be regularly confused that both "then" and "else"
is needed (because it's not required in many other languages).

Motivated by the comfortable relaxation of EnclosedExpr, I think it would be
great if we could make the else branch optional as well:

  IfExpr ::= "if" "(" Expr ")" "then" ExprSingle ("else" ExprSingle)?

As far as I can judge, the change in the grammar wouldn't cause any new
ambiguities.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 5 November 2015 10:25:45 UTC