Adding Unicode operators to D [use cases]
bearophile
bearophileHUGS at lycos.com
Tue Oct 28 10:12:58 PDT 2008
Sergey Gromov:
> I'd use dot "â
" and cross "Ã" products for 3D, union "âª" and
> intersection "â©", subset "â" and superset "â" and their negative forms.
> I don't think I'd use anything else.
I just want to note that the whole thread is almost unreadable on the digitalmars.com/webnews/, because it doesn't digest unicode chars at all. So adding unicode to D will give problems to show code.
Unrelated to the unicode, but related on those opSubset, opSuperset, etc:
while implementing a set() class with the same API of the Python sets, I have seen there are the following operators/methods too:
issubset(other)
set <= other
Test whether every element in the set is in other.
set < other
Test whether the set is a true subset of other, that is, set <= other and set != other.
issuperset(other)
set >= other
Test whether every element in other is in the set.
set > other
Test whether the set is a true superset of other, that is, set >= other and set != other.
A full opCmp can't be defined on sets, so I think in D1 we can't overload <= >= among sets... I think this is a problem has to be solved in D2, because sets are important enough.
Bye,
bearophile
More information about the Digitalmars-d-announce
mailing list