W3C home > Mailing lists > Public > www-ql@w3.org > April to June 2004

Re: questionable syntax choices for XQuery

From: Jonathan Robie <jonathan.robie@datadirect.com>
Date: Wed, 21 Apr 2004 12:20:28 -0400
Message-ID: <40869F4C.5020101@datadirect.com>
To: "Volkmann, Mark" <Mark.Volkmann@AGEDWARDS.com>
Cc: "'www-ql@w3.org'" <www-ql@w3.org>

Volkmann, Mark wrote:
> 
> 
> I dove into learning about XQuery this weekend.  While I like what I 
> see, I think some questionable syntax choices have been made.  Here are 
> three of them.
> 
> 1) Why is a semi-colon required at the end of a user-defined function 
> defintion?  It's clear that the end has been reached when '}' is 
> encountered.  I don't see how requiring a terminationg ';' makes parsing 
> any easier.  This is a known gotcha in C++.  I hate to see XQuery borrow 
> a syntax feature that is already a known issue.

Hi Mark,

XQuery does not have reserved keywords. This makes parsing more 
difficult in general, and we want to have a general way to make it easy 
for the parser to spot the end of a declaration. Therefore, all 
declarations, including function signatures, end with semicolons. This 
is easier to remember than requiring semicolons for some declarations 
but not for others. It's a bit redundant, but you do get used to it.

> 2) Smilies are an odd choice for comment delimiters.  Why choose 
> something that isn't used by any other common programming languages?

/* Does this comment make you smile? */

(: This one does! :)

Seriously, we had to find a syntax that would be unambiguous in any 
context where a comment can occur - in a language without keywords. This 
worked. We tried many alternatives before arriving at this one. And yes, 
the cheerfulness of this syntax is a factor.

> 3) Why use ':=' in let clauses instead of simply '='?  You know an 
> assignment is coming because of the presence of the keyword 'let'.  I 
> don't see how '=' could be confused for meaning something other than 
> assignment in that context.

You are right, but some of us have a preference to use different 
operators for different functionality. I think this is largely a matter 
of taste.

Jonathan
Received on Wednesday, 21 April 2004 12:21:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 22 July 2006 00:10:19 GMT