static foreach not working with this

Alex sascha.orlov at gmail.com
Mon Jan 7 16:29:25 UTC 2019


On Monday, 7 January 2019 at 16:16:57 UTC, Michelle Long wrote:
> On Monday, 7 January 2019 at 16:01:50 UTC, Michelle Long wrote:
>> static foreach(k, p; AliasSeq!(this, s))		
>> {{
>>     p.foo(); // Fails even if this line is removed
>> }}
>>
>> this not known at compile time. replace s with this and it 
>> works! s is an argument which is also not known at compile 
>> time(generally).
>>
>> Should work with this.
>>
>> Just "simplifying"
>>
>> this.foo();
>> s.foo();
>>
>>
>> (obviously more complex code)
>
> static foreach(k, p; AliasSeq!(Alias!this, s))		
> {{
>     p.foo(); // Fails even if this line is removed
> }}

referring to
https://forum.dlang.org/post/aqypsijjvajybtqtmnwt@forum.dlang.org

Do you trying to do a recursive call from foo to itself?


More information about the Digitalmars-d-learn mailing list