[Xpath-ng] List constructor syntax

David Rosenborg darolst at pantor.com
Wed Dec 4 11:10:53 MST 2002


Hi Jeni,

> > Yes, I know. I'm sure it can be made to work, I'm just not sure what
> > the advantage is, except for the previously mentioned feature that
> > you can get away without having an explicit list constructor.
> 
> Well, I think that's a fairly large advantage :) I also think it would
> simplify things for users if they didn't have to consider the fact
> that some functions might return a singleton list while others return
> an actual item, especially if that has an effect on whether you can
> pass the value on to another function.
> 
> Also, if we adopt the XPath 2.0 convention of using an empty list to
> mean an unknown or invalid value, then we really want every function
> to return a list (so that all functions work in the same way and some
> functions can return this "invalid" value), which means that functions
> will have to be able to take lists as arguments.
> 
> I don't know -- it just seems cleaner to say that every value is a
> list, if we can get away with it...
> 

I my opinion, treating everyting as a list would be somewhat odd.
Sometimes "magic" can be convenient, but in this case I think
it will be confusing instead. Having list conversion rules explicitly
specified per function makes things simpler and clearer. And
most important, it would be consistent with how type conversions
among strings, numbers and booleans are handled.

Also, I prefer that types are disjoint. Assume we had a function
is-list, then I would find it rather surprising if is-list (17) returned
true.

Cheers,
David





More information about the Xpath-ng mailing list