opStar
Chris Miller
chris at dprogramming.com
Sat Nov 10 08:53:39 PST 2007
On Sat, 10 Nov 2007 04:21:41 -0500, Janice Caron <caron800 at googlemail.com>
wrote:
> Since D lets us write p.member instead of (*p).member or p->member,
> where p is pointer
>
> ...and since we now have opStar() to overload *p
>
> ...does that mean that if a class A implements opStar(), and p is an
> instance of class A, then we get to write p.member to mean
> (*p).member? (Assuming no name clashes with A.member, of course)
>
> If not, is this sugar planned for the future?
>
> opStar() is only partway towards the ability to make
> pointer-like-objects. If we're going that way, let's go all the way.
What if, instead, D adds -> back but only as a user-defined operator. It
could mean redirected access. Instead of (*p).member, you could use
p->member and know it's not pointer access but object redirected access.
More information about the Digitalmars-d
mailing list