Using <> for opCmp
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Sat Nov 25 03:57:05 PST 2006
Anders F Björklund wrote:
> Lionello Lunesu wrote:
>
>> The operator < > <= >= all use opCmp, but if you want to differentiate
>> between the three cases (< == >) you either have to call opCmp
>> yourself or use multiple comparisons.
>>
>> I'd like to suggest using the operator <> for an implicit call to
>> opCmp, returning the actual comparison value (<0, 0, >0).
>
> I would prefer using <=> for this, as that is what Perl already does...
> It is commonly used when writing sort functions, and called "starship".
>
> Think it was suggested before, but the language wasn't taking in any
> more operators at the time ? (The other one was ^^ for logical Xor.)
>
> --anders
Sure is kinda funny when we start using emoticons for operators... ^^
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list