Odonno / ReduxSimple

Simple Stupid Redux Store using Reactive Extensions
http://www.nuget.org/packages/ReduxSimple/
MIT License
143 stars 19 forks source link

Why do you use "where T : class" in ObserveAction<T>? #45

Closed MihailsKuzmins closed 5 years ago

MihailsKuzmins commented 5 years ago

According to System.Reactive.Linq, the extension method OfType has no bounds - it can be of any type. So, is there any specific reason why you use "where T : class" in the ObserveAction functions where the only generic part is OfType ?

For example, it prevents using struct, or enum as action. Maybe you intended to use action only as a reference type and not as a struct, enum, etc. Just want to know. Thanks

Odonno commented 5 years ago

@MihailsKuzmins Good point. It is strongly impacted by the way I write my applications with this library/pattern.

But it makes sense to not only use class but also (readonly?) struct. I am not really sure if enum is a viable option but it can be another solution.

I will fix this that soon. Or you can create a PR if you want.

Odonno commented 5 years ago

@MihailsKuzmins Done. You will soon see the new package version here : https://www.nuget.org/packages/ReduxSimple/2.0.1

I hope you'll like it.

MihailsKuzmins commented 5 years ago

@Odonno thank you :)