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

Top N Most Common Mistakes

Torsten Grust grust at in.tum.de
Thu Aug 2 18:21:33 PDT 2007


  Top N Most Common Mistakes
Don,

consider the following XQuery expression:

	let $x := <x/> return $x is $x

which will return return true (`is' test for identical nodes).
Textual substitution of <x/> for all occurrences of $x leads
to
	<x/> is <x/>

which will return false (the two constructors construct two
distinct element nodes).  Referential transparency is lost
(we cannot replace $x with its value without changing the
meaning of the expression), the FP guys would say.

There are other issues (scoping, for example) which make plain
textual substitution of variables invalid -- concepts like bound
and free variables come into play, then.	

Cheers,
    --Torsten

On Aug 2, 2007 at 16:40, Smith, Donald T. wrote with possible deletions:
>> You still get the people who imagine that because variables are
> flagged
>> with a "$" sign they must work by textual substitution.
>
> I don't have the CS background to quite understand how variables work
> via textual substitution and how they work some other way. I do  
> know --
> from reading Michael Kay's books -- that XSLT is a functional language
> and that variables in XSLT can't be updated. I do understand quite  
> well
> template-based processing and recursive templates.
>
> If it's not too much of a digression into CS theory, could someone
> explain this point?

-- 
   | Prof. Dr. Torsten Grust                         http://x-query.com/mailman/listinfo/talk |
   |                                 http://www-db.in.tum.de/~grust/ |
   |     Database Systems - Technische Universität München (Germany) |



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4182 bytes
Desc: not available
Url : http://x-query.com/pipermail/talk/attachments/20070802/71c05f73/smime.bin


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.