Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement property.toStream() that preserves current value (unlike .changes)? #146

Open
rpominov opened this issue Sep 5, 2015 · 1 comment

Comments

@rpominov
Copy link
Member

rpominov commented Sep 5, 2015

Sometimes we need to convert property to stream but preserve current value (as much as a stream can do it — passing current value only to the first subscriber). Opening this issue to collect these use cases.

One such use case is constant([1,2,3]).flatten() that currently dispatches only 3, and can be "fixed" as constant([1,2,3]).toStream().flatten(). But we already considering two other ways of how this case can be fixed: #144 #142

What concerns me about this, is that we'll basically get Bacon's once(x) (infamous for its pitfalls for beginners, and problems with semantics) in form of Kefir.constant(x).toStream(), but we already have ways to create onces anyway...

@cefn
Copy link

cefn commented Sep 7, 2015

As someone coming from Bacon I have personally found that a lot of the brain-melting issues have been eliminated in Kefir because of the excellent, exhaustive and explicit documentation provided, which I struggled to find for Bacon. This means that even if there is a (deliberately) nuanced behaviour of an API operation, then it's consequences are comprehensible. However, there's no Royal Road to understanding FRP so I think architecting the library to try and get over fundamental misunderstandings by beginners and eliminating operations needed by power users for this reason sounds like the wrong choice.

I deliberately use streams which are intended to be consumed per-subscriber quite a lot, so I wouldn't favour the prevention of all once()-like behaviours through structural API choices. Rather it might be good to explicitly surface the special capabilities which activation-triggers can provide so people aren't surprised by them, (complementing subscription triggers like 'Property').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants