The Anh Tran wrote:
aarti_pl wrote:
Andrei Alexandrescu pisze:
> We're trying to make that work. D is due for an operator overhaul.
>
> Andrei
Is there any chance that we get possibility to overload "raw
operators", like in C++? I think that they may coexist with currently
defined operator overloads with simple semantic rules, which will not
allow them to work together at the same time.
..........
BR
Marcin Kuszczak
(aarti_pl)
Me also have a dream :D
<Daydream mode>
class Foo
{
auto op(++)(); // bar++
auto op(++)(int); // ++bar
Hey, wasn't the implementation of the postincrement operator through an
overload a rather untasty hack?
op(cast)(uint); // cast(uint)bar // opCast
auto op(())(int, float); // Foo(123, 123.456) // opCall
auto op(+)(Foo rhs); // bar1 + bar2
auto op(+=)(int); // bar += 1234;
auto op(.)(); // bar.xyz // opDot
Foo op([][][])(int, char, float); // bar[123]['x'][123.456]
auto op([..])(); // i = bar2[] // opSlide
auto op([..])(int, int); // bar[1..10]
auto op([..]=)(float); // bar[] = 12.3 //opSlideAssign
auto op([..]=)(int, int, float); // bar[1..3] = 123.4
}
</Dream>
Aside for a minor change in notation, there's no improvement. We're
looking for much more broad improvements, such as offering the ability
to overload several operators with only one function.
Andrei