Type of receiver

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 24 02:54:42 PDT 2015


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.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list