W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2004

Re: questionable syntax choices

From: Michael Brundage <xquery@comcast.net>
Date: Tue, 04 May 2004 21:14:25 -0700
To: Michael Kay <mhk@mhk.me.uk>, "'Volkmann, Mark'" <Mark.Volkmann@AGEDWARDS.com>, 'Jonathan Robie' <jonathan.robie@datadirect.com>, <scott_boag@us.ibm.com>
Cc: XQuery Public Comments <public-qt-comments@w3.org>
Message-ID: <BCBDB831.1BED%xquery@comcast.net>
Not to beat a dead horse, but donıt all the arguments in favor of semicolon
imply that the query body itself should end with one?

Otherwise, future versions of XQuery will be forever unable to add anything
after the query body and in this version itıs often impossible to determine
whether the body is prematurely terminated.

I could imagine this becomes especially relevant if XQuery ever wants to add
DML syntax, which might contain multiple statements in the query body and
need to separate these by semi-colons.  E.g.,

//foo (: select all foo :)
delete //foo[1] (: delete the ones that come first among their siblings :)
//foo (: select all remaining foo :)

vs.

//foo;
delete //foo[1];
//foo;



Cheers,

Michael Brundage
xquery@comcast.net

Writing as
Author, XQuery: The XML Query Language (Addison-Wesley, 2004)
Co-author, Professional XML Databases (Wrox Press, 2000)

not as
Technical Lead
Common Query Runtime/XML Query Processing
WebData XML Team
Microsoft



On 4/30/04 7:23 AM, "Michael Kay" <mhk@mhk.me.uk> wrote:
>>  
>>  
>> Okay, I remember that being said before, but it's not obvious to me why
>> that's the case.
>>  
>> Why  is it difficult to provide good error diagnostics if function defintions
>> only  have to be terminated by "}" instead of "};"?
>>  
>>>  
>>> A  high-level abstract answer is that error detection and recovery, for any
>>> input data, improves with the amount of redundancy in the data.
>>>  
>>>  
>>>  
>>> More concretely, XQuery is a language with no reserved words, and  without
>>> the semicolons, it was impossible to tell whether some invalid  construct
>>> was trying to be a declaration in the prolog or was trying to be  the main
>>> body of the query, or was just the result of the parser  getting confused.
>>> People really want to get multiple syntax errors out  in a single run, and
>>> for that you need some anchor points that the  parser can use for recovery.
>>>  
>>>  
>>>  
>>> For function definitions in particular it would be possible to get by
>>> without the ";" because the braces are present. But it's much cleaner in my
>>> view to have a consistent policy on delimiters: if you have  them anywhere,
>>> you should have them everywhere.
>>>  
>>>  
>>>  
>>> But as Jonathan Robie has said, we have to stop debating trivia and  agree
>>> to differ. There are lots of people impatient for us to get this  language
>>> finished, and they don't care a damn whether they have to  write semicolons
>>> or not, so long as they can have it by  Tuesday.
>>>  
>>>  
>>>  
>>> Michael Kay 
> 
Received on Wednesday, 5 May 2004 00:45:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:57 UTC