[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XQuery types was Re: Yet another plea for XU


integer compare
At 09:53 PM 5/7/2002 +0100, Bill de hÓra wrote:

>I don't for a moment dispute the usefulness of types, just /static/
>typing. Static typing as aid to programmer effectiveness is something of
>a myth, tho' it's very handy if you're a compiler or a runtime. Systems
>do get build with dynamically typed languages and seem to work fine;
>notably these languages are notoriously productive. If I'm wrong about
>this, that static typing vastly improves the lot of programmers, I'm
>happy to be corrected.

I think that depends a lot on what you are trying to accomplish. 
Personally, I find untyped languages fine for slogging text around, which 
most of us XML people do a lot. When I am doing typed operations on things 
that actually have data types, I do find that types can prevent some 
important errors.

Here's one example: I rewrote a library I had written so that it passed 
URLs rather than nodes. In my initial rewrite, I missed several changes 
that I should have made, and the result was a query library that was no 
longer type valid. By correcting the type errors, I would have fixed the 
problem. Only one problem - I was using an untyped implementation of 
XQuery. Because of this, I had to run the library on data and find the 
errors one at a time.

As you point out, static typing can definitely improve runtime performance. 
Consider comparisons. In XQuery, $a = $b can mean a lot of things. If you 
know both are singleton integers, you can just do an integer compare. If $b 
is a sequence, you have to do existential quantification. If both are 
strings, you need a string compare. The static type system can rewrite the 
query to do the appropriate compare without needing to examine the data. 
Without it, you have to pick your way through the data and use conditional 
logic to figure out which comparison to use.

Jonathan


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.