Hi,

just recently i wanted to use the [events 
module](http://forum.nim-lang.org///nim-lang.org/docs/events.html) to play 
around with, but since I'm a newbie to nim I ran into difficulties. Considering 
the following code: 
    
    
    import events
    
    type
      StringArgsRef = ref object of EventArgs
        args: string
      StringArgs = object of EventArgs
        args: string
    
    proc handleevent(e: EventArgs) =
      echo("handled")
    
    ee = initEventEmitter()
    ee.on("TestEvent", handleevent)
    
    var
      sArgsRef = StringArgsRef(args: "Hello")
      sArgs = StringArgs(args: "Hello")
    
    # compile error type mismatch
    ee.emit("TestEvent", sArgsRef)
    # works just fine, can even cast the event to StringArgs during handleevent 
proc
    ee.emit("TestEvent", sArgs)
    

My goal was to inherit from EventArgs to pass different types of arguments with 
the event. I dont unterstand how the behavior can be explained. Hope someone 
can help me!

Reply via email to