Calling an alias for a Class method in another scope

Jacob Carlborg doob at me.com
Fri Jun 1 07:14:26 PDT 2012


On 2012-06-01 15:51, Steven Schveighoffer wrote:
> On Fri, 01 Jun 2012 09:25:57 -0400, d coder <dlang.coder at gmail.com> wrote:
>> Class Bar(alias F) {
>> // Call F in some function here
>> }
>>
>> Class Foo {
>> void foo();
>> Bar!(() {foo();}) bar;
>> }
>>
>> Again this does not work. Maybe I am expecting too much from D. :-) I am
>> somewhat aware of the issues involved here. I have seen some earlier D
>> threads.
>
> lambdas cannot exist outside a function scope. This is a limitation of D
> that has been pointed out before, and I think it should be made
> available, but don't hold your breath :) D is just starting to get more
> filled out in the area of lambdas.

That can't work since there is no this-reference for "foo"?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list