Type of receiver
Marc Schütz via Digitalmars-d
digitalmars-d at puremagic.com
Sat Oct 24 06:38:41 PDT 2015
On Saturday, 24 October 2015 at 09:54:43 UTC, Jacob Carlborg
wrote:
> When the template this parameter feature was added to the
> language it was possible to use it for static methods:
>
> class Foo
> {
> static void foo(this T)()
> {
> pragma(msg, T.stringof);
> }
> }
>
> class Bar : Foo {}
>
> Foo.foo(); // prints "Foo"
> Bar.foo(); // prints "Bar"
>
> For some reason this feature was removed, it might be that it
> was never indented to work for static methods.
>
> Can we make it work again for static methods? It would be
> really handy for creating Objective-C bindings.
It was changed in this PR:
https://github.com/D-Programming-Language/dmd/pull/1687
It's hard to tell whether it was intentional though. But IMO your
code should work, so I suggest you file a bug report.
More information about the Digitalmars-d
mailing list