Live data from Hacker News

Elm is Wrong

reasonablypolymorphic.com

191–200 of 218 posts

Re: Elm is Wrong

#191
post #169

Earlier quoted context omitted.

Hi! I work at NoRedInk, the aforementioned company with 55,000 lines of Elm in production. We don't "copy-paste the same stuff over and over." That would suck. Why would we be excited about a language that made us do that? Our Elm code is about as DRY as our JS code was before, except the Elm code is way easier to maintain.

How do you compose update functions without writing the boilerplate let ... in for every Msg? How do you stop your main update function from growing endlessly as you add new Msgs? You need only look in the standard library for examples of boilerplate and not-DRY code. The map function is implemented separately for Lists, Arrays, etc. I really want to love Elm. But the more I wrote it the more I realised that the only…

> How do you compose update functions

If there's shared logic between update functions we extract it into a helper function. That also makes it easier to test.

I'm not sure how typeclasses would make composing update functions easier, but in this case we can be concrete. PureScript's Pux library implements the Elm Architecture, and PureScript has typeclasses. Would you mind showing me some Pux code that uses typeclasses to improve the situation you're talking about?

Re: Elm is Wrong

#192

Earlier quoted context omitted.

I find that there are times where I get into a "Someone is wrong on the internet" situation, but still think it's worth commenting. This is one of those times. My goal is not to win the argument, but rather I hope I can show you a different way to look at the situation. To be fair, the only reason I wrote my original reply to you was because you asked why people would down vote you. Clearly 15 seconds is unreasonable…

So is it fair to say that it is possible for me to conclude "xyz is broken" based on a single paragraph? For example, if I read the Wikipedia article on Perl 6, the second paragraph says "While historically several interpreter and compiler implementations were being written, today only the Rakudo Perl implementation is in active development." So let me skip the part where I spend 2 weeks picking up a language! Let's…

Having a single implementation is quite a different situation than having a missing feature that most people would consider necessary.

A better example would be back in the old days perl had no intrinsic OO support. Instead it had a library that made a few things easier. But basically, the OO support was hashes that pointed to functions. There was no syntactic sugar at all.

As an OO language Perl was fundamentally broken. You could still write OO code in Perl (and I happily did so for a very long time). But, yes, there were many people who claimed that Perl should be avoided because of this. Eventually full OO support was added and those voices died down.

The difference between that situation and this situation is that the author of Elm (as I understand it) has absolutely no intention of adding type classes to Elm. He has specifically chosen not to have them because he thinks it complicates the language. I happen to think that for his target audience, he is absolutely right. I think it is a good decision.

However, for the author of the blog post, the decision is wrong. Elm is intentionally broken. The author does not want to fix it and the blog post author thinks that this decision is wrong.

He also complains about the maximum size of tuples. The author of Elm believes that you should only have small tuples because you should be using records instead. This is contrary to how FP languages tend to work. Usually you use tuples. Records are the strange structure to work with. Again, I agree with the author of Elm, but the author of the blog post has a completely valid point. In his opinion, Elm is wrong.

The author of the blog post found a way to get around several of the problems he was having with Elm, but it required him to add or remove fields in records. The author of Elm had disabled that feature because it was complicated. Given that doing this removes the only way the blog post author (and me too) has to work around the lack of type classes, he was upset. Even though I understand the blog post author's frustration, I agree with Elm's author. JS implementations are optimised for objects that don't change structure. Records are implemented with JS objects and so allowing the records to change structure will impact performance in ways that the Elm programmer won't expect. It's a pity, but shit happens. Of course the blog post author thinks this is wrong.

Finally, it's not like you are locked down here. You can easily write an extension in JS to fix the issues the blog post writer has. But the kicker is that JS extensions can not be distributed with the normal Elm tools without approval from Elm's author. And Elm's author has said that he doesn't want those things fixed. So even if you wrote a work around, you aren't allowed to distribute it.

So given all this, I hope you can see the blog post author's point. Elm is fundamentally broken. The Elm's author knows that is broken and refuses to fix it. The only way inside the language to work around the broken feature was removed and Elm's author doesn't care. You could fix the problem by writing an extension, but Elm's author has blocked that avenue as well. You are not allowed to fix this problem.

This is what he feels is wrong. I completely understand his point of view, even if I disagree with his conclusion. Your characterisation of the situation trivialises it. You assume that there is no way the blog post author can know what he is talking about because he hasn't used the language long enough. You haven't spent the time yourself to understand what the issue is and why the blog post author is upset. You just assume he is a dumb ass. That's why you were getting voted down.

I spent a lot of time trying to explain the situation to you, so I hope at some point you find it valuable (even if it doesn't seem so right now). Like I said, sometimes I get the impression that spending my time on things like this is worth it. In my past, some people have graciously spent similar efforts to help me understand something and eventually it was helpful to me. I hope that will be the case here.

Re: Elm is Wrong

#193

Earlier quoted context omitted.

> I'm a Python programmer. I fully expect dict keys to be able to be arbitrary objects. I'm a Python programmer too, and I also fully expect dict keys to be able to be arbitary objects, and I get really frustrated with the fact that they can't be arbitary objects. They have to be hashable objects, and the hash function refuses to hash certain objects that it has decided aren't allowed.

Come on, how many time in your entire life did you need this ? For set, it's a bit more annoying. But for dicts. twice in 10 years maybe ?

[deleted]

Re: Elm is Wrong

#194

In cases where we're "acting on" some value, like a dictionary, surely we should be able to store the comparison function in the value? I don't know Elm, but something like the following Haskell: data Dict k v = D (k -> k -> Bool) [(k, v)] empty :: (k -> k -> Bool) -> Dict k v empty f = D f [] -- and so on Of course, this is a naive linear-time implementation; substitute with whatever alternative you like. If you alr…

http://package.elm-lang.org/packages/eeue56/elm-all-dict/2.0... is an example of a Dict where you pass in a custom (key -> comparable) function when initializing the datastructure.

Re: Elm is Wrong

#195
Elm is great and Purescript even better. I haven't though heard anyone building apps using Elm on both back-end and front-end.

I have enourmous respect for Anders Hejlsberg and his work but Typescript is not an answer. Typescript is limited in sense that from the beginning it was doomed to be just a superset of Javascript. And we all know about deficiencies and "bad parts" of Javascript.

Languages do matter and those with strong functional emphasis are better, because they enforce you to pursue specific discipline that allows you to write better code.

Of all functional languages (more or less popular today) in my opinion the best option is Clojure and Clojurescript. Clojurescript is simply amazing. It's robust, easy to learn, fast, adaptable, pragmatic, can cover your needs on all major platforms including iOS and Android. For a long time advocates of statically typed languages would point to one "weakness" of Clojure - its dynamically typed nature. But to begin with dynamism of Clojure types always considered its strength. Besides, Clojure today carries an instrument far more powerful than static types - http://clojure.org/about/spec. Clojure community is growing, language is gaining popularity. Because behind seemingly innocuous, and even arguably (at the first sight) not very appealing lispy syntax, there is an incredible elegance, power and true astonishment.

Re: Elm is Wrong

#196

tl;dr static typing adds lots of complexity to everything, just use Clojurescript instead. Ok, I'm jesting. And I like static typing. But sometimes it is easy to get lost in it when you just want to be productive instead.

As I noted in my comment: Clojure and Clojurescript now have a far superior instrument than static types, it has `Clojure.spec`

Re: Elm is Wrong

#197

Earlier quoted context omitted.

Elm has inspired ... the development of ReactJS I don't think that's true. React is a descendant of XHP, and predates Elm. Perhaps you were thinking of Redux?

Elm's virtual dom was inspired by Clojurescript's om, which was based off of React. So yeah, this is not true.

I've been writing in Clojurescript. To be honest - every time I see a new discussion thread about something new in Javascript-land I can't stop thinking that Clojure and Clojurescript are almost always a few steps ahead of the crowd.

Re: Elm is Wrong

#198
post #169

Earlier quoted context omitted.

How do you compose update functions without writing the boilerplate let ... in for every Msg? How do you stop your main update function from growing endlessly as you add new Msgs? You need only look in the standard library for examples of boilerplate and not-DRY code. The map function is implemented separately for Lists, Arrays, etc. I really want to love Elm. But the more I wrote it the more I realised that the only…

> How do you compose update functions If there's shared logic between update functions we extract it into a helper function. That also makes it easier to test. I'm not sure how typeclasses would make composing update functions easier, but in this case we can be concrete. PureScript's Pux library implements the Elm Architecture, and PureScript has typeclasses. Would you mind showing me some Pux code that uses typeclas…

Extracting to a helper function doesn't change the fact that there is boilerplate that must be overcome by brute force when composing "components". Every sub update function needs to be manually wired into the main update function since the introduction of Html.app. Libraries like elm-return make this a bit nicer to work with, but because of the restrictions in what Elm will let you do with it's "magic" there is no alternative.

I don't write PureScript, I can't help you there.

Re: Elm is Wrong

#199

Earlier quoted context omitted.

Elm's virtual dom was inspired by Clojurescript's om, which was based off of React. So yeah, this is not true.

I've been writing in Clojurescript. To be honest - every time I see a new discussion thread about something new in Javascript-land I can't stop thinking that Clojure and Clojurescript are almost always a few steps ahead of the crowd.

Used to write in clojure and clojurescript myself. While it's definetly nicer than React, React did come first (om and reagent are just bindings around React. The way om and reagent are faster than React out of the box, is what inspired Elm's vdom module).

Re: Elm is Wrong

#200
post #198

Earlier quoted context omitted.

> How do you compose update functions If there's shared logic between update functions we extract it into a helper function. That also makes it easier to test. I'm not sure how typeclasses would make composing update functions easier, but in this case we can be concrete. PureScript's Pux library implements the Elm Architecture, and PureScript has typeclasses. Would you mind showing me some Pux code that uses typeclas…

Extracting to a helper function doesn't change the fact that there is boilerplate that must be overcome by brute force when composing "components". Every sub update function needs to be manually wired into the main update function since the introduction of Html.app. Libraries like elm-return make this a bit nicer to work with, but because of the restrictions in what Elm will let you do with it's "magic" there is no a…

Don't understand how typeclasses would help you here. If you want immutable single source of truth, which is what Elm provides, you would do the same thing in Javascript/React and Clojurescript/Om.

I follow the same pattern in a 10k Javascript/React app I'm working on professionally. I don't see another way of doing things. Not that I'm looking very hard, cause this really isn't a problem.

Post reply on HN