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

Local namespace

John Snelson john.snelson at oracle.com
Fri Sep 11 16:05:35 PDT 2009


  Local namespace
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!

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