XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
abstract data types in XQuery? information hiding?

Suppose that a program written in a set of XQuery modules made use of
some abstract data type.  Suppose further that the programmer wished to
be able to experiment with different implementations of that abstract
data type.  (Maybe it's an XML element node, or a sequence of elements,
maybe it's a map indexed by strings, maybe it's a two-level map, maybe
...)

Since XQuery doesn't have the ability to declare new type names (or am I
missing something very important?), I don't see a straightforward way to
do this inside of XQuery.

As an alternative, I can imagine handling this with a level of
indirection (is there any problem in programming that cannot be solved
or papered over by adding a level of indirection?).

For example, I could use a macro pre-processor to define a short name
for the abstract data type and as its expansion supply the appropriate
type description.

    #define FOO element(foo)

or

   #define FOO map(*)

Then I can declare a function as

   define function make-foo($s as xs:string) as FOO {
      ...
   };

and run my source code through the macro pre-processor before submitting
it to the XQuery engine.

I suspect there are other ways.  (In my case, I work with a literate
programming system that allows me to maintain multiple versions of code
in parallel.  But I'm finding that method a little klunky, and it does
nothing to enforce appropriate information-hiding boundaries.  Although
neither does a macro-preprocessor, come to that.)

Do any readers of this list have experience with ways of layering some
feature over XQuery by use of a preprocessor of some kind, or by other
means?  Failing that, does anyone have ideas of suggestions that might
be worth trying?

Thanks!

-- 
C. M. Sperberg-McQueen
Black Mesa Technologies LLC
http://blackmesatech.com


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS