These are chat archives for jdubray/sam

13th
Feb 2017
Jean-Jacques Dubray
@jdubray
Feb 13 2017 01:18
Always a pleasure to (re)watch Dr. Lamport's intro on TLA+ https://channel9.msdn.com/Events/Build/2014/3-642
Rodrigo Carranza
@DrecDroid
Feb 13 2017 03:05
Really good lecture, thanks!
devin ivy
@devinivy
Feb 13 2017 03:28
@foxdonut where are you using streams? which stream lib?
perhaps i have not scrolled back enough :P
devin ivy
@devinivy
Feb 13 2017 03:33
ah, i've found the rocket launch example. interesting. if you think of it, definitely ping me when you've put out your latest!
@foxdonut in the actions i definitely miss the self-documentation you typically get with action-creators.
Fred Daoud
@foxdonut
Feb 13 2017 03:36
@devinivy thanks for having a look! how do you mean, about the action-creators vs the actions?
Fred Daoud
@foxdonut
Feb 13 2017 03:42
And to answer your question, I'm using flyd, but am in the process of "externalizing" the stream lib so that you can specify it. It's very simple, and flyd or mithril/stream work out-of-the-box.
devin ivy
@devinivy
Feb 13 2017 04:42
@foxdonut mostly referencing how counter: meiosis.stream() doesn't communicate what sorts of things are going to be mapped through that stream
Fred Daoud
@foxdonut
Feb 13 2017 04:56
@devinivy ah, I see. So what does that look like as an action-creator?
devin ivy
@devinivy
Feb 13 2017 12:54

@foxdonut could be all sorts of things– the redux way would be this,

actions.counter = (count) => ({
    type: 'UPDATE_COUNTER',
    payload: { count }
});

while i don't care for the constants, etc, i do like the self-documentation of these functions.

while you're thinking about stream implementations– gotta share this one! https://pull-stream.github.io/
Rodrigo Carranza
@DrecDroid
Feb 13 2017 13:01
What's the benefit of using Steams for
SAM?
devin ivy
@devinivy
Feb 13 2017 13:04
it's just another take on wiring. it looks like @foxdonut has some reasons to enjoy working with them. here's the example he put above,
http://codepen.io/foxdonut/pen/JEeqPY?editors=0010
Fred Daoud
@foxdonut
Feb 13 2017 13:17
@devinivy I agree, but in my example, nothing prevents you from doing that. I could have (better) named the stream updateCounter, and then the code that calls it could be actions.updateCounter(counterValue - 1)
@DrecDroid I like that you don't need constants, that you can explicitly map actions to model updates (aka acceptors), and then just feed the model to the view function. One action can "feed" multiple acceptors, and acceptors can "feed off of" multiple actions, if needed.
As someone said on the Mithril channel, "set up your pipelines and let the data flow" :)
I should also mention that I like having a single model object (the model data is not lost in streams) and that the stream use is very simple, nothing complicated like RxJs.
As @devinivy said it's another way of wiring SAM, and I think it's great to experiment with different approaches.
Rodrigo Carranza
@DrecDroid
Feb 13 2017 13:27
I have to get my mind around streams, they look useful but in practice could be difficult to understand
Fred Daoud
@foxdonut
Feb 13 2017 13:29
@devinivy thanks for the pull-stream reference :thumbsup:
Rodrigo Carranza
@DrecDroid
Feb 13 2017 13:29
Please take a look at the diagram I've posted before, I feel SAM could be implemented easily with good all imperative programming
Fred Daoud
@foxdonut
Feb 13 2017 13:30
@DrecDroid I did have a look and it's interesting, could you post the same rocket-launcher example implemented with your SAM library?
Rodrigo Carranza
@DrecDroid
Feb 13 2017 13:32
Of course just give me some time to write it :)
Fred Daoud
@foxdonut
Feb 13 2017 14:46
Of course :)
Rodrigo Carranza
@DrecDroid
Feb 13 2017 18:43
I don't know how to share typescript runnable code, I've inlined source maps and source with the js output. The source code can be viewed with Chrome Developer Tools under Sources tab then inside Codepen > codepend.io > arcr/ts. I'll try to find another way to share It. This is the codepen : http://codepen.io/arcr/pen/GrPVBZ