- From: Xavier Franc <xfranc@online.fr>
- Date: Thu, 11 Dec 2003 19:00:16 +0100
- To: public-qt-comments@w3.org
Some remarks about the treatment of namespaces for function and variable names:
* There is a strange asymmetry between functions and variables:
- functions have a default namespace, variables haven't.
- function declared in a main module must have the 'local' prefix,
while variables are allowed to be in the empty namespace.
- (editorial remark) nothing is said about the namespace/prefix of a function
declared in a library module (it must probably also match the
namespace of the module, but that should be made explicit)
- it sounds odd that "All variable names declared in a library module *must be
explicitly* qualified by the namespace prefix of the module's target namespace."
Wouldn't it be simpler to force this namespace if no prefix is specified ?
This is a common practice in most programming languages.
that is, in the following example the variable $v would be automatically in
namespace X:
module namespace x = "X";
declare variable $v { ... }
* the name resolution mechanism in force is rather rudimentary: this "default
namespace" system was perfectly justified for XML elements, because element
names are not ncessarily declared (therefore a more sophisticated mechanism
wouldnt work), but it seems hardly justified for variables and functions of
a modern programming language.
Imagine I have to write "java.lang.String" each time I use String in Java,
or even worse that I must first declare a prefix to be expanded into "java.lang."
and put it in front of String ! (something like java:String)
It is certainly too late to change this in XQ, but I wanted to say it:
there is no fundamental necessity of a "default function namespace" !
* In: 4.5 Default Namespace Declaration
This sentence seems both odd and superfluous:
"The effect of declaring a default function namespace is that all functions in the
default function namespace, including implicitly-declared constructor functions, are
*aliased with a name that has the original local name, but no namespace URI.*"
--
Xavier FRANC
Received on Thursday, 11 December 2003 12:58:16 UTC