On 12/04/2015 02:37 AM, Mike wrote:
On Friday, 4 December 2015 at 01:04:33 UTC, Idan Arye wrote:
People are going to hate me, but http://dpaste.dzfl.pl/851d1d1f5e4b
Doesn't seem to scale to member access: http://dpaste.dzfl.pl/37193377524c
/d649/f987.d-mixin-3(7): Error: 'this' is only defined in non-static
member functions, not fun
Is there a way to make it work?
Mike
template namespace(string code,alias a=void){
mixin(code);
}
struct List{
int x;
alias stable = namespace!(q{
void fun(){
import std.stdio;
writeln(this.x);
}
},x);
}
void main(){
List lst;
lst.stable.fun();
}
:o)