An issue with setting delegates via templates
    Andrej Mitrovic 
    andrej.mitrovich at gmail.com
       
    Thu Oct 27 09:01:21 PDT 2011
    
    
  
So it seems this is an issue with a newer signals implementation.
The old one works:
import std.signals;
struct Foo
{
    mixin Signal!(int) sig;
}
class Bar
{
   void x(string) { }
   void x(int) { }
}
void main()
{
    Foo foo;
    auto bar = new Bar;
    foo.sig.connect(&bar.x);
    foo.sig.emit(1);
}
But the new reimplementation (not in Phobos) doesn't:
import signalsnew;
struct Foo
{
    Signal!(int) sig;  // no need for mixin in new signals
}
class Bar
{
   void x(string) { }
   void x(int) { }
}
void main()
{
    Foo foo;
    auto bar = new Bar;
    foo.sig.connect(&bar.x);
    foo.sig.emit(1);
}
The new one: https://gist.github.com/1194497
I'll investigate this further then.
    
    
More information about the Digitalmars-d-learn
mailing list