Comma problem Re: ANSWERS to "What's wrong with XQuery" questionMichael Rys mrys at microsoft.com
Wed Jul 28 19:35:58 PDT 2010
I remember that we had considerable discussions about both during the design of the language. Unfortunately, there was no easy way to do either if I remember correctly... Michael -----Original Message----- From: http://x-query.com/mailman/listinfo/talk [mailto:http://x-query.com/mailman/listinfo/talk] On Behalf Of Daniela Florescu Sent: Wednesday, July 28, 2010 11:30 AM To: Mike Sokolov Cc: http://x-query.com/mailman/listinfo/talk Talk Subject: Re: Comma problem Re: ANSWERS to "What's wrong with XQuery" question Mike What I understand from this discussion is that there are two independent problems. 1. Maybe the precedence of "," was wrongly chosen in XQuery 1.0, and the current design is not the most intuitive. Even if this is true, that's too late to change that, unfortunately. 2. Maybe instead of DirectElementConstructor as an expression we should allow an XML fragments (aka a sequence of XML DirectElementConstructors, without commas in between), to make it look and feel more like real XML. Granted, I have the same understanding problem with 9 out of 10 new people to whom I am teaching XQuery. W3C should consider it. Best regards Dana On Jul 28, 2010, at 11:04 AM, Mike Sokolov wrote: > The comparison with arithmetic operators is a bit of a stretch, since > we all learnt that precedence in elementary school math class. But I > do agree, it's just a question of operator precedence, not a question > of right or wrong - just a question of convention and matching user > expectation. That's why I introduced my complaint with "programmers > used to C++/Java/ etc." I guess I feel there is a principle that in > the absence of a good reason to do things otherwise, one should stick > to convention since it helps with quick understanding for new users. > It was somewhat surprising to me, coming from that background, that > the precedence of "," was so low, and from the other responses, it > seems some others shared (or at least have been made aware of) the > same confusion, although it is, as you say, easily remedied. > > -Mike > > On 07/28/2010 01:31 PM, Daniela Florescu wrote: >> Andrew, >> >> It's not a matter of statements introduced by ",". >> >> Comma is just an infix operator like +. (granted, not as frequently >> used in programming languages like +, but still widely used). >> >> It's a question of the precedence of the operators in the grammar- >> and I don't understand why is this different from other languages. >> >> When you learn what the semantics of >> >> 1+2*3 >> >> you have to learn that * has higher precedence then +. >> >> Same here, FLWOR expressions have higher precedence. >> >> Best regards >> Dana >> >> >> On Jul 28, 2010, at 2:10 AM, Andrew Welch wrote: >> >>> for $l in ('a', 'b', 'c') >>> return $l, 'd' >> >> _______________________________________________ >> http://x-query.com/mailman/listinfo/talk >> http://x-query.com/mailman/listinfo/talk _______________________________________________ http://x-query.com/mailman/listinfo/talk http://x-query.com/mailman/listinfo/talk
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format