== Quote from Tomek Sowiński (j...@ask.me)'s article > > pragma(msg, typeof(bar.val(someValue))); // Bar, not Foo. > This looks like a job for the template this parameter: > T val(this T)(int newVal) { > _val =3D newVal; > return cast(T) this; > } > Funny enough, if you put Bar into Foo (Foo bar =3D new Bar; ) it doesn't= > = > work no more. > Tomek
NO #$(&$# WAY!!!!! I (ab)use D metaprogramming constantly and was completely unaware of template this parameters. This is **exactly** what I needed and I can't believe it's in the language already.