snivilised / lorax

🌟 reactive extensions for go (a pseudo rxgo version 3)
MIT License
5 stars 0 forks source link

define new Bridge operator to complement Map #230

Open plastikfan opened 6 months ago

plastikfan commented 6 months ago

The current Map operator works, but it does not allow for items to be mapped to values that are not a T. This is quite restricting. We need to define a new operation that can turn an existing observable based on type T to another based on type O (other).

We can't simply add O to item, because that would also mean introducing it to every other generic class in the package. That would be unwise for the reason that the O type would not normally be required, but would need to be specified; but to what?; some kind of new nothing type?. Instead, we need a new Bridge instance, that is aware of both type T and O and provides the necessary mapping. The bridge would either have to be an object in its own right or a function that connects the 2 types. Note, that this would necessarily have to break the fluency currently in place; a new fluency chaiin would begin but based on type O instead of the original type T.