He starts with some sort of rant against HTML because "It's 2016". As if:
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [] [ text (toString model) ]
, button [ onClick Increment ] [ text "+" ]
]
were more readable than <div>
<button onClick="decrement()">–</button>
</div>
<div>
<button onClick="increment()">+</button>
</div>
Iit's obviously not. The Elm formatter even gets the indentation wrong: the divs are on the same level, yet indented differently (and I know why, but it's wrong nonetheless).So I have no idea what problem anyone could have with writing HTML. It's actually one of the nicer markup languages around.
I also don't buy this legend that Elm is so easy to read, non -programmers could understand it. The update function given as an example is a nested 50-line switch statement that any sane linter would drown in wiggly red. When we take away the comments, this is what is left:
update : Msg -> Model -> Model
update msg model =
case msg of
Input name ->
{ model | name = name }
Save ->
case (model.playerId) of
Just playerId ->
model
|> updatePlayerNames playerId
|> updateNameInPlays playerId
|> clearInputBox
...and so on. It uses a lot of English words, too many actually, because people seem to think that makes it as easy to parse as a sentence.Let's try: "Case model playerId of Just playerId? Model updatePlayerNames playerID! Nope, that's gibberish.
Don't get me wrong – Elm is really exciting, especially against the sweltering heap of Javascript in the background. But not for those reasons.
(He does get to the core "yadda yadda state" argument later on)