3 ms·
Some thoughts on Elm Development
- matt4077 10y agoI actually think Elm is quite cool and am working in it right now. But I disagree with almost anything the author says. 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)
- hugocbp 10y agoI completely agree with you. I'm really excited about Elm, specially because of the quality of everything in the community and ecosystem, but to say that the syntax is better than HTML or that it is readable by non-programmers is a bit of a stretch. When I first ran into Elm the first thing I looked for was an alternate syntax of some sort. The tech is amazing and I truly believe we got something here that will last, but not because of the syntax.
- sotojuan 10y agoThe obvious jab against OOP via TypeScript is interesting considering RxJS 5 and Cycle—both functional tools—make use of it.