opStar
Michel Fortin
michel.fortin at michelf.com
Sat Nov 10 07:15:12 PST 2007
On 2007-11-10 09:27:30 -0500, "Janice Caron" <caron800 at googlemail.com> said:
>> Smart pointers will have to be done a different (and hopefully better)
>> way in D.
>
> Well here's to that. Looking forward to finding out what it is.
a.opStar.b
But seriously, operator overloading's goal is to allow the programmer
to use a consistent syntax for native and non-native types. It seem to
me that opStar is pretty limited compared to other operators which can
be overriden. Not only it doesn't allow you to use a simple syntax for
calling aggregate's members -- as in `a.b` instead of `(*a).b` -- but
since D doesn't have a reference type as you have in C++, implementing
something as simple as `*a = b` is going to be pretty complicated for
any non-object value (objects are reference types in D).
So, I'm left wondering about why this operator was made overridable in
the first place if it's so limited.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list