|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] XQuery Style ConventionsMichael Rys mrys at microsoft.comFri Oct 28 10:34:48 PDT 2005
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! 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
|

Cart








