These are chat archives for jdubray/sam

6th
Dec 2017
Jean-Jacques Dubray
@jdubray
Dec 06 2017 17:22
@dfkaye_twitter I tend to be allergic to actions mutating the state, any "functional" pattern that take and event and return a new state (Elm, Redux, ...) is a dead end IMHO. This approach to application state mutation is too naive.
Łukasz Lityński
@hex13
Dec 06 2017 19:54
why do you think it is too naive?
david kaye
@dfkaye_twitter
Dec 06 2017 20:06
@hex13 - re "actions mutating state" - according to SAM pattern - actions should propose changes, not make them - the model should accept the proposal or reject it - the state should represent the new modeled state or reject it and/or call a next step (correct me if I'm wrong, @jdubray )
Łukasz Lityński
@hex13
Dec 06 2017 20:17
Such approach seems to be possible in Mobx using intercept.
I wonder if we need "actions" at all
maybe just observable properties would be sufficient?
david kaye
@dfkaye_twitter
Dec 06 2017 20:19

Unrelated thought here. See if you agree.

Things that bother me about a UI library or framework:

  • custom html attributes (data-something is OK, :something is not)
  • custom template syntax ({{ hello }} or {> partial } vs. ${ hello } )
  • custom template logic inside custom attributes
  • dependencies
  • inheritance
  • having to write logic "inside" it rather than passing that into it; prefer to keep what makes my thing unique separate from the render function...
Fred Daoud
@foxdonut
Dec 06 2017 20:29
@dfkaye_twitter totally agree! perhaps you might like the Meiosis pattern. It's a pattern, not a library -- so you don't tie your code to a framework-specific API. Works best with either a virtual-DOM library of your choice (your favourite shouldn't have any of that custom template nonsense), or anything else that can (re-)render a view. This enables you to write your views as view = function(state).
david kaye
@dfkaye_twitter
Dec 06 2017 20:55
Thanks @foxdonut - I've been aware of meiosis for a while - and mithril and flyd, et al - but haven't used them in anything meaningful or deep. That meiosis wiki has a lot of information and examples. What pattern or example would you recommend as the fundamental one to getting started - and coming back to - if any?
david kaye
@dfkaye_twitter
Dec 06 2017 21:01
Thanks, @hex13 - mobx intercept as a concept sure looks interesting - but without "actions" per se, what would initiate a change call to mobx? (I have no experience with it so I'm asking the dumbest question I can think of :)
david kaye
@dfkaye_twitter
Dec 06 2017 21:08
OK, another question about how these UI/virtual-dom libraries work. Are they replacing elements or updating their content and attributes instead?
Fred Daoud
@foxdonut
Dec 06 2017 21:09
@dfkaye_twitter to get started, I'd refer to the fundamental setup and the corresponding example.
david kaye
@dfkaye_twitter
Dec 06 2017 22:27
Final unrelated-to-sam post of the day - I found a bug in Number.toFixed() this week (surprising, right?) and wrote a blog post about it.
https://dfkaye.wordpress.com/2017/12/06/number-tofixed-rounding-errors-broken-but-fixable/