|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Local namespaceJohn Snelson john.snelson at oracle.comFri Sep 11 16:05:35 PDT 2009
Martin Probst wrote: > Indeed, you may not define functions or variables in modules that > don't have the same namespace URI as the module: > > "The name of every variable and function declared in a library module > must have a namespace URI that is the same as the target namespace of > the module; otherwise a static error is raised [err:XQST0048]." > > Why that must be, I have never understood. It doesn't save the user > from hard-to-find typo errors errors as you'd always declare the > namespace prefix while declaring the module namespace, and then use > that prefix. And it (IMHO) actively acts against modularization, as > local variables or functions are highly desirable. In X-Hive / xDB, we > have never followed that spec rule and allowed local > functions/variables in modules, those are simply not exported to > importing modules. XQuery 1.1 is introducing the "private" function modifier, which will allow the definition of functions that aren't exported from a module. > I have also never really understood why it must be possible to have > one module with one target namespace split over multiple files; I > think Java has shown that the forced one-to-one relationship between > conceptual name (class) and file (.java) is a good thing. 1) Modules aren't classes, they are more like library APIs. 2) Java's rules are by no means universally considered a good thing. In particular it might be beneficial to split up a 5000 line Java class into multiple files, or to group together implementations of the same method from multiple implementations of a class. 3) Actually the XQuery spec doesn't say anything about whether a module namespace can be split across multiple module files - that's left implementation defined. John -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net
|
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
|






