Re: qt-2004Feb1159-01: Last Call comments on XQuery 1.0: An XML Query Language XSCH-QL-016

Jonathan Robie wrote:

> I'd rather not get into discussing whether the things other vendors have 
> asked for in their environments are really necessary, because I don't 
> know all the ins and outs of their architectures. But it sounds like 
> what I propose above will not be a problem in your environment?

Not quite sure "what you propose above".  You mean "below", I assume.

> I'm confused. Two Java modules that depend on each other can be compiled 
> independently, linked, and executed.

No, they can't:

$ cat A.java
public class A
{
   public static int foo () { return B.foo(); }
}
$ cat B.java
public class B
{
   public static int foo () { return C.foo(); }
}
$ javac A.java
./B.java:3: cannot resolve symbol
symbol  : variable C
location: class B
   public static int foo () { return C.foo(); }
                                     ^
1 error

Note javac requires modules that are only indirectly needed.
That strictly speaking isn't needed:  To compile A, we need B,
but it should be possible to compile A without C - but it isn't.

> The internal draft that we are exploring calls a module resource a 
> 'module', and 'import module' imports all the modules with a given 
> target namespace.
> 
> You call that 'a recipe for trouble'. Can you explain more?

Well, it appears to require a database of modules.  It appears to
preclude a conventional implementation where you can search for a
module by mapping the module/package/namespace name to a file name.
Instead, we have to search for *all* matching modules.  This is
awkward.  No programming language I know of works this way.  (Java
does have a "import package.*" statement but all that does is add
to a search path.)  Of course it is possible to implement a
specification of "import all modules with a given namespace", but
please don't do this without including a non-normative description
of how this would be happed to a filesystem *without* using a database,
and *without* using global search:  How are people supposed to "deploy"
XQuery applications in a file system?   You can require that people
write a configuration file, but that is inconvenient and definitely
needs to be standardized, at least in a non-normative way.  (Note
that configuration files are a critical part of the servlet standard.
You can't wave it away as being "implementation specific.")

Alternatively you can allow modules to be imported lazily:  When the
compiler sees a function call n:f it can look for the definition
of f using its expanded-QName.  But in that case you don't really
inport modules - you just import individual definitions.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

Received on Friday, 27 August 2004 06:41:49 UTC