Type problem with Observable.Create from Boo

Posted by Tristan on Stack Overflow See other posts from Stack Overflow or by Tristan
Published on 2011-03-18T06:11:26Z Indexed on 2011/03/18 8:10 UTC
Read the original article Hit count: 263

Filed under:
|
|

I'm trying to use Reactive Extensions from Boo and am running into type problems. Here's the basic example:

def OnSubscribe(observer as IObservable[of string]) as callable:
    print "subscribing"

    def Dispose():
        print "disposing"

    return Dispose

observable = System.Linq.Observable.Create[of string](OnSubscribe)
observer = System.Linq.Observer.Create[of string]({x as string | print x})
observable.Subscribe(observer)

The Subscribe here gives a System.InvalidCastException: Cannot cast from source type to destination type. The issue appears to be with how I'm creating the observable, but I've struggled to see where the type problem arises from.

Ideas?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about system.reactive