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

RE: Constructor functions & `cast as` -- why both?

Subject: RE: Constructor functions & `cast as` -- why both?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 5 Jul 2005 09:43:28 +0100
RE:  Constructor functions & `cast as` -- why both?
> According to the XPath specifications are constructor 
> functions and the cast 
> expression defined to be semantically equivalent. I wonder, 
> why then provide 
> both?

There were two reasons for retaining the "cast as" syntax after constructor
functions were introduced:

(a) "cast as" gives you the choice of whether to allow an empty sequence as
the operand (returning an empty sequence as the answer) or not.

(b) constructor functions aren't available for types whose names are in no
namespace, unless you want to namespace-qualify all system functions with
fn: (e.g. fn:count()). Since many people use no-namespace schemas, and
they're quite likely to include types with names that clash with system
functions, no-one could come up with a way of handling these other than
retaining the "cast" syntax.

Remember that committees find it much easier to add something to a language
than to take something out.

Michael Kay
http://www.saxonica.com/

Current Thread

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-2013 All Rights Reserved.