Short list with things to finish for D2
Gzp
galap at freemail.hu
Wed Nov 18 23:52:33 PST 2009
bearophile wrote:
> Andrei Alexandrescu:
>
>> * Encode operators by compile-time strings. For example, instead of the
>> plethora of opAdd, opMul, ..., we'd have this:
>>
>> T opBinary(string op)(T rhs) { ... }
>>
>> The string is "+", "*", etc.
>
> Can you show an example of defining an operator, like a minus, with that?
>
> In my set data structure I'd like to define "<=" among two sets as "is subset". Can that design allow me to overload just <= and >= ? (opCmp is not enough here).
>
> Bye,
> bearophile
And what about the unary operators. Sorry I was not following the
opBinary thread from the beginning, so it might have been discussed
before. If opBinary has a syntax like this, unary operators require
something like this at least just for completeness.
(And maybe trinary operators ?: ) :)
Can they still be overloaded ? Will they have a similar syntax ? If so
what about the e++ and ++e operators? How they are distinct ? Or is the
latter eliminated from the language ?
Though, I like the idea, just a quick look at a code and you can see all
the operators in a place.
Bye, Gzp
More information about the Digitalmars-d
mailing list