Current spec restricts mappings or hashmaps can be compared with mapping=? only if they share the same comparators. It is reasonable if we look at the group of submapping procedures as set predicates. However, since mapping=? is also used for the equality predicates of make-mapping-comparator and make-hashmap-comparator, it can be overly restrictive. Especially, it would be useful to allow to create a hashmap of hashmaps which do not share the key comparators (they are not equal.) Also, a mapping of mappings which do not share the key comparators can be created if an implementation defines some ordering in key comparators.
I am not yet convinced about this feature request. I think it is cleaner to use mapping-map/monotone! to coerce mappings to mappings with a common comparator.
If we want to allow such heterogeneous mapping-of-mappings / hashmap-of-hashmaps, we could either:
1. Loosen mapping=? to allow mappings/hashmaps of different key-comparators (they are not equal)
2. Define make-mapping-comparator/make-hashmap-comparator such that its equality predicate returns #f if given mappings/hashmaps don't share the comparator, and obey mapping=?/hashmap=? otherwise.
For make-mapping-comparator, we would also have to define a total order on the set of key-comparators involved so that the comparator returned by make-mapping-comparator is able to provide an ordering predicate.
How could we do this?
--
Marc
3. Leave it to imlementation's extension (interpretation of "error").
I think it is useful enough (at least heterogeneous hashmap-of-hashmaps) to guarantee that it works portably, and option 2 is reasonable.
To unsubscribe from this list please go to http://www.simplelists.com/confirm.php?u=oa8YQq670QJsajDJIblEsMJ9MoezHUAm