[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

XQuery Style Conventions

Michael Rys mrys at microsoft.com
Fri Oct 28 10:34:48 PDT 2005


  XQuery Style Conventions
I personally prefer to not repeat the for and lets and write:

let $set1 := (3,2,1)
  , $set2 := (1,2,3)
for $x in $set2
  , $y in $set1
return
  $x +$y

Best regards
Michael

> -----Original Message-----
> From: http://xquery.com/mailman/listinfo/talk [mailto:http://xquery.com/mailman/listinfo/talk] On
Behalf
> Of Martin Probst
> Sent: Friday, October 28, 2005 2:22 AM
> To: http://xquery.com/mailman/listinfo/talk
> Subject: Re:  XQuery Style Conventions
> 
> Hi,
> 
> > let $set1 := (3,2,1)
> > let $set2 := (1,2,3)
> > for $x in $set2
> >      for $y in $set1
> >      return
> >          $x + $y
> >
> > As all for and let clauses simply add another variable and are equal
> > is that respect [...]
> 
> that's quite an interesting question. I generally prefer to keep them
on
> one level in smaller queries, but in certain cases one might argue for
> indentation. In this example both the let statements simply bind a
> value, but the for statements iterate. That's the difference.
> 
> So by indenting the for statement, one might express that this is (at
> least conceptually) a n*m operation, iterating the whole cross product
> of the two sets (btw: sets? there are no sets in XQuery ... except if
> you specify "unordered").
> 
> > Personally, I prefer to keep them all at the same level to keep the
> > query compact (and it also fits well with the grammar).
> 
> Well, if you have queries going over hundreds of lines with >10
> different for/let clauses, it is actually very helpful to get at least
a
> guess at which level of loop nesting you are. Otherwise you just have
a
> long sequence of statements on the same indentation level, so the
> indentation doesn't give you any information. I like the style they
> propose.
> 
> Regards,
> Martin
> 
> _______________________________________________
> http://xquery.com/mailman/listinfo/talk
> http://xquery.com/mailman/listinfo/talk



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.