[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|