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

problem with loops

Michael Rys mrys at microsoft.com
Wed Jan 4 02:39:08 PST 2006


  problem with loops
We so far raise an error in our XQuery implementation. I know it is
non-standard, but safer for our users, at least for now....

Best regards
Michael (another one :-))

> -----Original Message-----
> From: http://xquery.com/mailman/listinfo/talk [mailto:http://xquery.com/mailman/listinfo/talk] On
Behalf
> Of Michael Kay
> Sent: Wednesday, January 04, 2006 1:24 AM
> To: 'Martin Probst'; http://xquery.com/mailman/listinfo/talk
> Subject: RE:  problem with loops
> 
> 
> >
> > > declare function lcl:caller()
> > > {
> > >        let $QV1 := request:request-parameter("val1","")
> > >        let $count:= 0
> > >        let $QV1:= lcl:tracer($QV1)
> > >
> > > for $d in /maps/map
> > >        let $k:= lcl:rend($QV1)
> > >        let $QV2:= $QV1
> > >        let $QV1:= lcl:tracer($k)
> > >        return $QV2
> > > };
> >
> > Your problem is that $QV1 is not "overwritten", you can't re-declare
> > variables in XQuery. Meaning: the first $QV1 is a completely
different
> > variable than the second
> 
> Some of us argued long and hard that this should be a syntax error
(that
> is,
> that you should not be able to declare two variables with the same
name),
> but we lost the case unfortunately. It's a shame, because even in a
> language
> like Java that does allow variable assignments, using the same name
for
> two
> different variables is almost invariably a strong indicator of a
> programming
> error. We've become very familiar over the years with XSLT beginners
> attempting to write code like the above: in XSLT 1.0 this gives you a
> syntax
> error, but sadly in 2.0 this is no longer the case.
> 
> Michael Kay
> 
> 
> 
> _______________________________________________
> 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-2007 All Rights Reserved.