Re: MicroXPath

>After adding a few more features here and there I realized that I should just implement something more rigorous, so I started to reason about how a proper MicroXPath might look. Why not start with the great simplicity of XPath 1 but borrow a few of the neat tricks from XPath 2+ (read sequences)?


I'm missing any sense of what the guiding design principles are.

Why are you doing regular expressions differently from the way XPath 2.0 does them, for example?

I think it's definitely important that the language should be relationally complete (i.e. allow you to do arbitrary joins), and that requires range variables.

If you're aiming for maximum power with minimum syntax then I think you definitely want a basic set of functional programming primitives: the ability to define functions and use them to map and filter sequences. With that capability you can actually drop an awful lot of XPath 2.0 extensions without losing much.

If you're starting from scratch, I've always felt that redefining axes as functions and node-tests as predicates ought to give some mileage in terms of reducing the number of concepts; perhaps use the concept of "abbreviated syntax" to map following-sibling::x to following-sibling(.)[name(.)='x'].

The way that XPath 2.0 extended "/" to allow atomic values on the right but not on the left has always seemed deeply unsatisfactory, and I'm not sure how you are tackling that problem. You seem to have extended "|" to apply to atomic values, and to have extended the concept of document order to be an ordering over all items, which might be the answer: you can then have "!" as a simple map/apply operator, and "/" to mean "!" with ordering and deduplication of the result, but with no constraints on the type of the operands.

Things like date and time handling are of course very important to users but there's no reason they need support in the language, they can just be function libraries, and you don't lose much by representing date/time values as strings rather than with custom data types.

Michael Kay
Saxonica

Received on Saturday, 9 July 2016 10:17:14 UTC