"static" UFCS

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Thu Jun 14 02:43:43 PDT 2012


On Thu, Jun 14, 2012 at 10:46 AM, Jacob Carlborg <doob at me.com> wrote:
> UFCS can be used to emulate adding new members/instance methods to a class
> or struct:
>
> class Foo
> {
> }
>
> void bar (Foo foo, int x) {}
>
> auto foo = new Foo;
> foo.bar(3);
>
> Is it possible, somehow, to emulate adding new _static_ methods to a class,
> something like this:
>
> void fooBar (/*something*/, int x) {}
>
> Making this possible:
>
> Foo.fooBar(4);
>
> --
> /Jacob Carlborg

I'd expect it to look like this:

void fooBar(Foo)(int x) {}

-- 
Bye,
Gor Gyolchanyan.


More information about the Digitalmars-d mailing list