On 03/29/2011 09:15 PM, dsimcha wrote:
== Quote from bearophile ([email protected])'s article
The operator overloading done with opCmp is too much coarse even if you want to
implement sets with operators like<=< > >= == for subset, etc.
Can you please give an example of where<=,>, etc. are useful for representing
set operations? My naive opinion (i.e. without understanding your use case) is
that using comparison operators to represent anything besides partial or total
ordering is a severe abuse of operator overloading. (Their use to represent
ordering of corresponding elements of a vector or matrix is a borderline case.)
Agreed.
Wild guess: maybe Bearophile meant < <= > >= as operators for subset/superset
predicates? Anyway, this is a very different idea.
A different, far less abusing, use of those operators on sets may be to compare
cardinality, as in the original theory of natural numbers as sets; here, I
guess, the analogy is far more meaningful and totally consistent.
Denis
--
_________________
vita es estrany
spir.wikidot.com