[Xpath-ng] Proposal for definition of values/lists
Robin Berjon
robin.berjon at expway.fr
Wed Nov 27 10:11:51 MST 2002
Hi Jeni,
Jeni Tennison wrote:
> [Issue: Should we have node sets instead of generic lists?]
I prefer generic lists as they tend to be more powerful. I guess we can get set
functionality with a set() function, or something similar.
> [Issue: Should we allow only flattened lists rather than allowing
> lists to hold lists?]
I think lists should be able to hold lists.
> [Issue: Should we allow heterogeneous lists or only allow lists
> whose items are all nodes, all atoms or all lists?]
heterogenous
> [Issue: Should the string "false" cast to boolean false?]
I think that would be going a bit too far with dwimery.
> Lists are cast to strings and numbers by converting the first value
> in the list to a string or number; if the list is empty you get an
> empty string or NaN. Lists are cast to boolean true if they contain
> any values, boolean false if they do not.
Defaulting to the first item seems counter intuitive to me.
> [Issue: Should lists be converted to strings by concatenating the
> string value of each value, with spaces as separators?]
Yes, I think that is more user friendly (and of course doesn't preclude us from
providing a separate join() function).
In addition to that, I think that lists should numify to the number of their
items (flatly, not taking into account the length of their content), and thus
that empty lists should numify as 0, not NaN. An empty list is still a list,
even if it's a list of nothing. NaN is not a number, but zero is (I hope the
parallel is clear).
> [Issue: Do we need any more built-in data types?]
The only one I can think of is functions. A language that can't pass those
around is very quickly limited.
--
Robin Berjon <robin.berjon at expway.fr>
Research Engineer, Expway
7FC0 6F5F D864 EFB8 08CE 8E74 58E6 D5DB 4889 2488
More information about the Xpath-ng
mailing list