On Monday, 23 September 2013 at 06:31:01 UTC, monarch_dodra wrote:
I'm filing a bug report right now.
http://d.puremagic.com/issues/show_bug.cgi?id=11107
I understand. So, at least it's has interesting behaviour and big
question)
Code below shows that I would achieve:
/ fire.d
alias void delegate() EventHandler;
class Event(T)
{
private T[] _events;
public void opOpAssign(string op)(T param) if (op == ~)
{
_events ~= param;
}
public void opCall(ParamType ...)(ParamType params)
{
/// fire.d
import std.stdio;
alias void delegate() EventHandler;
class Event(T)
{
private T[] _events;
public void opOpAssign(string op)(T param) if (op == ~)
{
writeln(param.funcptr);
_events ~= param;
}
public void opCall(ParamType ...)(ParamType
On Sunday, 22 September 2013 at 18:31:20 UTC, Michael wrote:
/// fire.d
import std.stdio;
alias void delegate() EventHandler;
class Event(T)
{
private T[] _events;
public void opOpAssign(string op)(T param) if (op == ~)
{
writeln(param.funcptr);
_events ~=
This:
//
auto eventObserver = new Event!DelegateType();
//
Does not do what you think it does: It *statically* initializes
eventObserver to the *single* new Event!DelegateType();. SO
basically, all your instances are sharing the same Event.
I'm surprised this compiles at all,