[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: abstract data types in XQuery? information hiding?

  • From: Michael Kay <mike@saxonica.com>
  • To: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>
  • Date: Mon, 17 Jun 2024 22:36:53 +0100

Re:  abstract data types in XQuery?  information hiding?
I explored this a little at


and see also

 https://github.com/qt4cg/qtspecs/issues/220

But the basic answer is that we don't really have any mechanism for data hiding in the QT languages, and it's not easy to graft on.

Michael Kay
Saxonica

On 17 Jun 2024, at 18:35, C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com> wrote:

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

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@l...
subscribe: xml-dev-subscribe@l...
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php


PNG image



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


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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