locked
Generalized Publish family of operators - Can't mumble anonymous types RRS feed

  • Question

  • One problem with this new approach (for Prune & Publish, Replay etc)

    xs.CombineLatest(ys, (x,y) => new{x,y}).Publish(new Subject<?>(), ...)

    This with the specialized versions of Publish, Prune & Replay this was possible.


    --------------------------------------------------------------------------------
    James Miles http://enumeratethis.com

    Thursday, December 30, 2010 3:06 PM

Answers

  • In that case, we would probably just have Prune/Replay/Publish.

    Otherwise, we would need to replace/augment every constructor with a factory method so that types can be properly inferred. 

    • Marked as answer by fixedpoint Monday, January 10, 2011 10:31 PM
    Monday, January 10, 2011 10:30 PM

All replies

  • Hi James,

    With the new model it is easy to create extension methods to provide replacement functionality, e.g.:

        public static IObservable<T> PublishReplay<T>(this IObservable<T> source)
        {
          return source.Publish(new ReplaySubject<T>());
        }
    

    I do like the new ability to substitute different types of ISubject into Publish/Multicast.

    One question though is whether the Rx "language" should incorporate some specific ISubject behaviours as well as the "routing" semantics of Publish. If not, then maybe Prune & Replay need to appear in a community contribution library, as valuable ways to solve a specific problem.


    Friday, December 31, 2010 6:42 AM
  • >I do like the new ability to substitute different types of ISubject into Publish/Multicast.

    I agree, it's more flexible.


    James Miles http://enumeratethis.com
    Friday, December 31, 2010 10:54 AM
  • Would it be useful to have factory methods since these can use type inference?

    Saturday, January 8, 2011 12:05 AM
  • I was thinking something like that, or if you're adding back the Prune/Replay/Publish methods it might not be a problem.
    James Miles http://enumeratethis.com
    • Marked as answer by fixedpoint Monday, January 10, 2011 10:31 PM
    • Unmarked as answer by fixedpoint Monday, January 10, 2011 10:31 PM
    Sunday, January 9, 2011 11:04 AM
  • In that case, we would probably just have Prune/Replay/Publish.

    Otherwise, we would need to replace/augment every constructor with a factory method so that types can be properly inferred. 

    • Marked as answer by fixedpoint Monday, January 10, 2011 10:31 PM
    Monday, January 10, 2011 10:30 PM