Writing adaptor/wrappers with most scalability and least work
Pie? via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jun 3 18:04:08 PDT 2016
I would like to temporarily write some adapters or wrappers for
various types that allow the most extensibility with the least
amount of work. The goal is to get moving quickly as possible and
not try to implement all future needs. The wrappers will slowly
turn into full their own types and not be wrappers at all.
Obviously this requires declaring an interface and such. I
curious if I could somehow easily delegate work to the the types
I would like to wrap without designing a full fledged oo type.
e.g.,
class Image
{
alias this pImage;
}
So, for all purposes Image acts as pImage(except for constructor
calls). Of course now I'm bound to pImage's interface which I
might not like/want but it gets me pretty far and I can extend it
immediately with things I do not want in Image that are in pImage.
Any ideas on a good way to approach this? Is there some D tricks
that make life easier?
More information about the Digitalmars-d-learn
mailing list