[Xpath-ng] List constructor syntax
Uche Ogbuji
uche.ogbuji at fourthought.com
Tue Dec 10 10:56:47 MST 2002
> Hi David,
>
> > 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.
I'm not a fan of statically typed function signatures, so this argument
doesn't really move me. I would certainly prefer to keep XPath's untyped
functions, which would move the issue you bring up purely to function
semantics, which is where I believe it belongs.
> 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.
The empty-list-as error convention in XPath is, IMHO not a good idea to
genralize if we move to generic lists. Again, I think that the error flag is
a matter of function semantics, not core behavioral model. For example, I
would expect a numeric function to return NaN in case of error rather than
empty list.
I do think we'll have to consider a module for error signalling.
> I don't know -- it just seems cleaner to say that every value is a
> list, if we can get away with it...
Maybe, but I also feel it's cleaner to have a clear separation between lists
and atoms.
I think we probably need better developed use cases to hash this out.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html
Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html
RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p
yth11.html
Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb
ugxs.html
More information about the Xpath-ng
mailing list