[xquery-talk] XQuery Style Conventions

Till Westmann till.westmann at bea.com
Fri Oct 28 23:23:14 PDT 2005


On Oct 28, 2005, at 2:21 AM, Martin Probst wrote:

>> 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.

As a FLWOR expression can have any number of for and let clauses but  
only one of each of the other clauses, all the expressions that are  
evaluated based on the variable bindings of the for and let clauses  
are evaluated at the same level. That level is given by the number of  
for clauses in the FLWOR. (Whenever there is a nested FLWOR in a  
where or return clause there should obviously be some form of  
indentation.)
So the trade-off is between counting for clauses and wasting columns.
I think that saving columns is worth counting for clauses.

Best regards,
Till


More information about the talk mailing list