I'm trying to compile this example. But it fails to compile. What's wrong? 
    
    
    import asyncdispatch
    
    let event = newAsyncEvent()
    event.addEvent(proc() = echo "test")
    event.trigger()
    
    
    Run

Compiler error: 
    
    
    test.nim(4, 6) Error: type mismatch: got <AsyncEvent, proc (){.gcsafe, 
locks: 0.}>
    but expected one of:
    proc addEvent(ev: AsyncEvent; cb: Callback)
      first type mismatch at position: 2
      required type for cb: Callback
      but expression 'proc () = echo ["test"]' is of type: proc (){.gcsafe, 
locks: 0.}
    
    expression: addEvent(event, proc () = echo ["test"])
    
    
    Run

Reply via email to