scoped classes and dependency inversion

Sjoerd Nijboer dlang at sjoerdnijboer.com
Thu Nov 8 15:11:16 UTC 2018


On Thursday, 8 November 2018 at 12:45:57 UTC, Alex wrote:
> Hmm... not sure, if I got your idea... Do you think about 
> something like this?
> 
  **snip**
> 
> class Bar(TFoo) if(is(TFoo : IFoo))
> {
> 	typeof(scoped!TFoo()) _foo;
> 	this()
> 	{
> 		_foo = scoped!TFoo();
> 	}
> }

Yes, pretty much.
Except if you want to pass a parameter to TFoo it'll become a 
mess.
And I expecially don't want it to become messy.


More information about the Digitalmars-d-learn mailing list