DIP66 - Multiple alias this

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Sep 28 21:11:04 UTC 2020


On Mon, Sep 28, 2020 at 08:45:33PM +0000, mw via Digitalmars-d wrote:
> On Monday, 28 September 2020 at 20:28:17 UTC, mw wrote:
> > On Monday, 28 September 2020 at 19:41:07 UTC, H. S. Teoh wrote:
> > > I can see some situations for which you want two distinct
> > > instances of A.x (there should be two distinct resources acquired
> > > by D), and some other situations for which you want them to be the
> > > same (the same resource should be shared by B and C).  How does
> > > Eiffel cater to both cases?
> 
> I didn't handle just 2 cases, but all kinds of cases, whether in the
> Derived class D.x. you want *any* or even *none* of A.x, B.x, C.x, all
> kinds of combination, the programmer can specify exactly what s/he
> wanted using
> 
> -- undefine
> -- redefine
> -- rename
> -- select
> 
> I showed 5 examples in Eiffel way, you can do it as an exercise of all
> the other combinations.

Good. Now make it work for D. :-P

Note that this is easy to do in Eiffel because it has a dynamic memory
layout; D does not.  Making it work for D will be extremely complex, and
probably will not justify the comparatively meager benefits relative to
the cost.


T

-- 
Today's society is one of specialization: as you grow, you learn more and more about less and less. Eventually, you know everything about nothing.


More information about the Digitalmars-d mailing list