Does D have too many features?
Jonathan M Davis
jmdavisProg at gmx.com
Sun Apr 29 05:37:42 PDT 2012
On Sunday, April 29, 2012 16:28:23 Dmitry Olshansky wrote:
> On 29.04.2012 10:42, Jonathan M Davis wrote:
> > But regardless of whether you use alias this or opDispatch, you have the
> > same problem with regards to ->. In C++, . would be used to call the
> > smart pointer's functions, and -> would be used to call functions on the
> > object pointed to. In D, the two aren't distinguished - both use . - so
> > you can't have any functions on the type pointed to which conflict with
> > the smart pointer's functions, or you won't be able to call them (unless
> > another way to call them is provided somehow). So, it's definitely
> > something that C++ does better with as far as that goes.
>
> So you just need not to have any _member_ functions on smart pointer?
> Just use free functions that take SmartPointer!T. UFCS may also lend a
> hand if T and SmartPointer do not have ambiguous funcs.
That could work (though they'd obviously have to be in the same module as the
smart pointer - not exactly an onerous requirement - in order to be able to
access its private members).
- Jonathan M Davis
More information about the Digitalmars-d
mailing list