Adding Unicode operators to D [use cases]

KennyTM~ kennytm at gmail.com
Tue Oct 28 11:44:50 PDT 2008


bearophile wrote:
> 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

If the two sets are incomparable, just return NaN... We need an opCmp 
that returns a float :)


More information about the Digitalmars-d-announce mailing list