Erik Massop wrote:
I was thinking along these lines:
key = xmmsv_new_string("artist") val =
xmmsv_new_string("Metallica") entry=xmmsv_new_pair(key,val)
list_append(list,entry)
Would key really be an xmmsv_value_t, as that might disallows
bindings to convert dicts to the native hash-tables, unless
dict/propdict would use pairs/triples internally and guarantee the
types of the some of the elements.
This example was part of the "there is no dict" idea. Where
mediainfo_get just returns a list of (string,whatever) pairs. (or
((string,string),whatever) pairs, for sources).
Are you thinking about some specific language?
Also just because xmmsv allows you to do strange things doesn't mean you
have to :)
int pair_cmp_car(xmmsv_t *v, xmmsv_t *d) { xmmsv_t *car;
xmmsv_get_pair_car (v, &car) return strcmp (xmmsv_get_string (car),
xmmsv_get_string (d)); }
They are hereby strings?
Convention. You know that the method you called returns a certain type.
(xmmsv_iter_find would be replaced with xmmsv_iter_bisect if we do
that list-is-array and list-is-sorted)
Maybe a binary-search-tree (BST)?
Maybe. BST (may) have better insert/remove performance than a sorted
array, but same lookup complexity and worse memory overhead, and code
complexity (especially if you want to keep it balanced).
anders
--
_______________________________________________
Xmms2-devel mailing list
Xmms2-devel@lists.xmms.se
http://lists.xmms.se/cgi-bin/mailman/listinfo/xmms2-devel