From: Colin P. A. <co...@co...> - 2007-12-26 13:37:12
|
>>>>> "Eric" == Eric Bezault <er...@go...> writes: Eric> Colin Adams wrote: >> OK - mystery solved. >> >> The function concerned is: >> >> XM_XPATH_ATOMIC_SORT_COMPARER.raise_non_comparable_exception Eric> I don't understand this implementation in class Eric> XM_XPATH_ATOMIC_COMPARER: Eric> ~~~~~~~~~~~~~~~~~~~~~~~~ are_comparable (an_atomic_value, Eric> another_atomic_value: XM_XPATH_ATOMIC_VALUE): BOOLEAN is -- Eric> Are `an_atomic_value' and `another_atomic_value' comparable? Eric> require first_value_not_void: an_atomic_value /= Void Eric> second_value_not: another_atomic_value /= Void do if Eric> an_atomic_value.is_untyped_atomic then Result := Eric> an_atomic_value.as_untyped_atomic.is_comparable Eric> (another_atomic_value) else if Eric> an_atomic_value.is_numeric_value then Result := Eric> an_atomic_value.as_numeric_value.is_comparable Eric> (another_atomic_value) else if Eric> an_atomic_value.is_string_value then Result := Eric> an_atomic_value.as_string_value.is_comparable Eric> (another_atomic_value) else Result := Eric> an_atomic_value.is_comparable (another_atomic_value) end end Eric> end end ~~~~~~~~~~~~~~~~~~~~~~~~ Eric> How is it different from: Eric> ~~~~~~~~~~~~~~~~~~~~~~~~ are_comparable (an_atomic_value, Eric> another_atomic_value: XM_XPATH_ATOMIC_VALUE): BOOLEAN is -- Eric> Are `an_atomic_value' and `another_atomic_value' comparable? Eric> require first_value_not_void: an_atomic_value /= Void Eric> second_value_not: another_atomic_value /= Void do Result := Eric> an_atomic_value.is_comparable (another_atomic_value) end Eric> ~~~~~~~~~~~~~~~~~~~~~~~~ I can't tell either. So I've simplifed it. I think this may have come from splitting out XM_XPATH_ATOMIC_SORT_COMPARER as a separate class, but also I note from the early history that I initially hadn't implemented all types, and was testing for this and raising an exception for the unimplented cases. Then I guess I must have gradually added other types in, and failed to notice that at the end there was no longer a need for the tests. -- Colin Adams Preston Lancashire |