On Sat, 24 Jul 2010 16:44:38 +0200, dsimcha <dsim...@yahoo.com> wrote:
== 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.
What, this is seriously already here? Why the fuck was I not informed?
Seriously, this is one under-advertised feature.
--
Simen