These are chat archives for pozadi/kefir

25th
Mar 2015
Sergey Lapin
@lapanoid
Mar 25 2015 21:53
Is there something similar to https://github.com/baconjs/bacon.js/#join-patterns in kefir ?
@pozadi
Sergey Lapin
@lapanoid
Mar 25 2015 21:59
I am thinking to use kefir with flux, this attempt with bacon https://github.com/niklasvh/react-bacon-flux-poc/blob/master/examples/flux-todomvc/stores/TodoStore.js looks promising, but it naturaly based on join-patterns
Roman Pominov
@rpominov
Mar 25 2015 22:40
@lapanoid No, there is not. The .scan method is pretty similar to .update, though.
I found myself often using a pattern like this
Kefir.merge([
stream1.map(fnThatReturnsFn1),
stream2.map(fnThatReturnsFn2),
stream3.map(fnThatReturnsFn3)
]).scan(function(prev, fn) {return fn(prev)}, initialValue);
Sergey Lapin
@lapanoid
Mar 25 2015 22:51
There is neither templating in kefir? https://github.com/baconjs/bacon.js/#bacon-combinetemplate
Roman Pominov
@rpominov
Mar 25 2015 22:54
Noop, just use .combine and build the object in the handler function.
Sergey Lapin
@lapanoid
Mar 25 2015 22:55
These things are good candidates for PR or u intentionally don't want them?
Roman Pominov
@rpominov
Mar 25 2015 22:59
One of the reasons why .combineTemplate isn't present is that I think it can't be implemented so it will perform as fast as manual .combine
Not sure it's the reason not to add it, though)
Sergey Lapin
@lapanoid
Mar 25 2015 23:02
But it still could beat bacon version..)
What about join-patterns?
Roman Pominov
@rpominov
Mar 25 2015 23:05
Also my most recent idea about Kefir API is that it should be as small as possible (see pozadi/kefir#71) There is a lot of benefits from it, and boilerplate code isn't a big problem. So .combineTemplate the only value of which is minimizing boilerplate code, isn't good candidate to be added to the API.
Oh, such a slow english writer I am)
About join-patterns — not sure, never closely looked at those methods.
Sergey Lapin
@lapanoid
Mar 25 2015 23:08
Same with me) kinda silly situation)
It reminds me pattern matching from haskell cool staff
Roman Pominov
@rpominov
Mar 25 2015 23:10
Yeah, looks cool, but can't think of a real use case for them where something like .scan wouldn't work.
Sergey Lapin
@lapanoid
Mar 25 2015 23:14
Okey I got your point, simplicity over convinient - fair enough
Roman Pominov
@rpominov
Mar 25 2015 23:22
I'd say simplicity over comfort. To me using .combine instead of .combineTemplate, for example, is as convenient. But the .combine is also easier to understand, and there is less things to learn to be productive with the code (especially if it written by someone else).
I recommend you to watch this talk http://www.youtube.com/watch?v=4anAwXYqLG8 it's great, and describes what I mean very well.
Sergey Lapin
@lapanoid
Mar 25 2015 23:28
Yeah I started to watch, I don't argue with u, your position totally makes sense.
Roman Pominov
@rpominov
Mar 25 2015 23:36
Yep, just wanted to describe my point a little more)