Live data from Hacker News

My Increasing Frustration with Clojure

ashtonkemerling.com

71–80 of 240 posts

Re: My Increasing Frustration with Clojure

#71
post #62
post #55

Earlier quoted context omitted.

I was thinking of learning a modern language for the web back end. After analysing elixir, go and clojure I decided to go for clojure. Uhmmm, maybe go? I don't know :X. Stick with php? Meehhh

Depends on features you need for the web backend.

I was looking for a cool new language to learn in the holidays and hopefully do something with it web related. Like a back-end. Nothing serious though. Elixir seems way different from the languages I am used to maybe that is good.

Re: My Increasing Frustration with Clojure

#72

Something that is often very hard to understand (it took me years to do so). Is that maintaining a language is insanely hard. Everything has a cost. Let me give a good example: A few years back someone submitted a patch that improved the error messages in Clojure. Worked great, just a single extra "if" and a message. It was committed to master. Then people's code got way slower. Why? Well this was a often used functi…

it's too bad the JVM inlining budget isn't configurable or hintable, that seems like a poor design decision to have to work around. Then again, the JVM probably wasn't originally intended to be the foundation for a dozen other languages

Re: My Increasing Frustration with Clojure

#73

Clojure is not a community-driven language. It belongs to Rich Hickey and by extension Cognitect. The bugs that will be fixed and the features that will be added are the ones Hickey cares about. Not saying this is good or bad. It's just how Clojure development is ran.

> Clojure is not a community-driven language

> The bugs that will be fixed and the features that will be added are the ones Hickey cares about

Those two statements do not compute. A community driven language, or any technology that wishes to attract and retain users, really, should care about the things that its users care about. I can understand that the significance of these bugs might not be well understood by Clojure's maintainers, but that is the problem here. It is the task of technical maintainers to care about the problems of their users (speaking as the maintainer of several projects).

It's also worth answering that argument that Clojure is opinionated and therefore the maintainers don't need to fix certain things, because... opinions. This is bogus. Opinions are what lead you to build certain features, like transducers. Caring about quality is what should lead you to make sure they work in a way that is expected (based on how others parts of the technology work, what is least surprising to users, what is documented, etc.)

Re: My Increasing Frustration with Clojure

#74
post #60

Earlier quoted context omitted.

> To build it outside of clojure ecosystem, you would need to first build all the pieces of the clojure ecosystem That's simply untrue, and even the author's conclusions contradict your point. You can already do all of these things with just javascript. And if you're arguing that javascript has rebuilt the entire clojure ecosystem, then what is the non-aesthetic case for clojure? I like clojure a lot and I've made a…

What do you think the time delta would be between building it in JS vs Clojure would be? Just curious.

It really depends on so many different factors. The javascript ecosystem is at least 100x the size of clojure's, but as a consequence, the average quality of what's available is much lower. If the pre-existing libraries and services will work for your use case, javascript is going to be faster, simply because most of the code you need has already been written.

Another important consideration is your familiarity with both. If you have a deep knowledge of javascript and its ecosystem, many of the architectural wins you get from clojure out of the box are fairly trivial to port over. I suspect the reverse is not as true, because a clojure expert dipping their toes into javascript doesn't have as clear a picture of what the limitations are and how to overcome them.

As we can already see in this thread, there's a tendency for people who use clojure to believe that some architectural concepts are literally impossible for all other languages, rather than merely less common or requiring some pre-configuration.

Re: My Increasing Frustration with Clojure

#75
post #51

Earlier quoted context omitted.

This is one architecture that is made possible by clojure: http://tonsky.me/blog/the-web-after-tomorrow To build it outside of clojure ecosystem, you would need to first build all the pieces of the clojure ecosystem

Thanks for pointing me to that article. I've been mulling over for years how to architect apps to remove the server, that layer never sat well with me. I've also found I couldn't discuss the problem with anyone because "clients can't access the database directly!" is such a knee-jerk reaction.

If clients access the database directly, then the database is now the server. You haven't removed the server, you've just moved it.

Re: My Increasing Frustration with Clojure

#76
> And the namespace is completely riddled with bugs. union returns duplicates if some of the inputs are lists instead of sets depending on their length.

to be clear I assume he is taking about this:

``` try-spec.core=> (clojure.set/union [1,2] [1,2]) [1 2 1 2] ```

Though im not sure what "depending on their length means".

> for the above bugs there are two possible fixes: raise an IllegalArgumentException if anything other than sets are provided

Isn't this an argument for types? Wont this type of problem be prolific in any dynamic language? What is the union of anything besides sets?

> coerce lists and vectors to sets before continuing

This only works for very similar data. How do you coerce a map into a set? Is it based on keys or values? What about a string? is it based on the whole string or the characters. I loaded up python3 to see how it was handled...

``` In [7]: set(["hello"]).union(["hello"]) Out[7]: {'hello'}```

is that what you would expect? Maybe. But honestly it should have thrown an error imo. Python is just skirting the issue. A set needs a hashable type. A list isn't one because its mutable. So python knew you "meant" a set of the items in the list... It throws up its hands if you force the issue further:

``` In [8]: x = [1,2,3]

In [9]: set(x) Out[9]: {1, 2, 3}

In [10]: set([x]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 set([x])

TypeError: unhashable type: 'list'```

The problem is that we have handed the union function the wrong type of arguments. That it fails in further down stream is the trade off we make with dynamic languages. The community seems to admit the trade off and alleviate it with things like clojure.spec. Im not mental equipped to argue type theory here. But i suppose i feel this is an _ancient_ argument and saying its a "bug" seems simplistic.

> How you define getting the wrong type with nonsense values counts as “working” is beyond me. Is it just because it doesn’t throw an Exception? Anyone here prefer bad data instead of exceptions when dealing with functions like this? I doubt it.

This is maybe the deeper problem. You would expect union to fail given the wrong types. Sure the failure wont be a type error but it will be contained inside the function. Leaking out the wrong data means its harder to debug. I'm generally curious how and why set would work on lists at all.

As to the rest of the arguments made here. I don't know enough to hazard a guess. But i would appreciate any feedback on my interoperation of the above situation.

Re: My Increasing Frustration with Clojure

#77

Earlier quoted context omitted.

You're getting down voted; probably because the way you worded your question. I'm giving you an up, because I, too, am very curious how something is possible only in Clojure and nothing else.

This is one architecture that is made possible by clojure: http://tonsky.me/blog/the-web-after-tomorrow To build it outside of clojure ecosystem, you would need to first build all the pieces of the clojure ecosystem

Funny how more and more application are becoming game-like rendering system.

Re: My Increasing Frustration with Clojure

#78

Something that is often very hard to understand (it took me years to do so). Is that maintaining a language is insanely hard. Everything has a cost. Let me give a good example: A few years back someone submitted a patch that improved the error messages in Clojure. Worked great, just a single extra "if" and a message. It was committed to master. Then people's code got way slower. Why? Well this was a often used functi…

It's also what happens when the implementation becomes the specification that others depend on, rather than having the implementation depend on a specification.

In the former, any deviation, including bugfixes, from the existing implementation is a breaking change. Indeed, without a specification, it's debatable whether any behavior is actually a bug or not.

Re: My Increasing Frustration with Clojure

#79

Something that is often very hard to understand (it took me years to do so). Is that maintaining a language is insanely hard. Everything has a cost. Let me give a good example: A few years back someone submitted a patch that improved the error messages in Clojure. Worked great, just a single extra "if" and a message. It was committed to master. Then people's code got way slower. Why? Well this was a often used functi…

it's too bad the JVM inlining budget isn't configurable or hintable, that seems like a poor design decision to have to work around. Then again, the JVM probably wasn't originally intended to be the foundation for a dozen other languages

It is with -XX:MaxInlineSize=35 (that's the default number of bytecodes to consider inlining)

Re: My Increasing Frustration with Clojure

#80

Something that is often very hard to understand (it took me years to do so). Is that maintaining a language is insanely hard. Everything has a cost. Let me give a good example: A few years back someone submitted a patch that improved the error messages in Clojure. Worked great, just a single extra "if" and a message. It was committed to master. Then people's code got way slower. Why? Well this was a often used functi…

You seem to be sidestepping some of the points made by the OP, particularly where certain bugs defy conventions laid down in other parts of the language. Garbage-in-garbage-out is fine so long as it's done in a consistent, well-understood way across the language (ie: throwing IllegalArgumentException). It seems to me that instead of being a strategic approach for dealing with such issues in a consistent way across the language (clearly this is not the case), your arguments are just an excuse for not fixing the damn issues (if that's what you're getting at). And that is truly bizarre.
Post reply on HN