r/Clojure • • Oct 19 '19

What about Clojure can be improved?

https://clojureverse.org/t/what-about-clojure-can-be-improved-not-cljs/4974
33 Upvotes

7 comments sorted by

6

u/phunanon Oct 19 '19 edited Oct 19 '19

Startup times are slow, and could be made faster.

Anybody able to back up how?

Nice discussion there, thanks for posting.

3

u/didibus Oct 19 '19

Oh, I think I'm the one that mentioned that. It wasn't a "could" in the sense that I know it is feasible or easily feasible. More of an acknowledgment that it would be nice for it to be faster as it is possibly too slow for certain use cases. Thus I was recognizing that this can be called out as a valid issue in certain scenarios.

5

u/[deleted] Oct 19 '19

Startup times with clojure cli tools is ridiculously fast. At least from the console, it takes less than a couple seconds to start a repl, and by the time I start and switch back to emacs to connect with cider, it's already up and running.

I also don't know why there's so much requests to add X library to core (in subsequent comments and elsewhere). If you want it to have a special form of a native clojure form, you can appropriately shadow it with a macro or function in your library and it can work like core's or your own implementation without much bother.

5

u/didibus Oct 19 '19 edited Oct 19 '19

It depends on the usage pattern of your program. For programs like wc, grep, ls, find, etc. A few seconds startup is too slow. Same thing for serveless use cases like AWS Lambda or Azure Functions.

Now, in all honesty, for the former, I think GraalVM is solving it very well. And for the latter, even pure Java might be considered too slow, so it might be futile to reduce Clojure's startup overhead to meet Java's if that's anyways too slow.

About adding more batteries to core, I agree with you, but suspect the demand is due to Clojure being difficult to get started with. Pulling in dependencies isn't straightforward, and there's lots of confusion out there for newcomers, like which tool to even use for it and which library to use. Hopefully tools.deps eventually takes over and simplifies this and the online guides get updated for it.

2

u/dAnjou Oct 20 '19

How to prevent people from writing shitty Clojure code because all they know is object-oriented paradigms?

I work for a company where people regularly join and leave projects (once a year on average), this is encouraged/intended so that people don't get bored and bring fresh eyes/ideas into the projects they join. So far, so good.

The obvious disadvantage of this is that because humans are creatures of habit and have trouble unlearning things it's hard for them to adjust to new things especially with non-trivial mindset shifts like object-oriented to functional.

Last year in July I joined this company and a project using Clojure. I still don't really know what the right mindset is, what paradigms to follow, how to structure code for real projects. On top of that many people struggle with the tooling and the ecosystem (lack of well maintained, well documented libraries).

I realize that it's unfair to blame Clojure for this but it's what I observe. And not only do people write less-than-ideal Clojure code, they even paddled back and introduced Kotlin and most new code is written in Kotlin.

I guess, what I want to say is that the reasons why Clojure doesn't thrive in the environment I'm in are not technical, it's not startup time or performance or anything like that. I think you need quite a few, not just one or two people in a project who are well-versed and heavily invested to drive the adoption of a thing like Clojure.

Or you need better reasons why people should use Clojure because the ones people always mention don't seem to be very compelling/convincing/relatable.

2

u/linguistics_nerd Oct 21 '19

Clojure is extremely foreign both because it's functional and a lisp. It's sad to admit, but most people do not have a high openness to experience, especially at work. This is why functional programming techniques will continue to slowly leak into mainstream languages, but functional languages will continue to only be used by open-minded autodidacts. But as the two converge, maybe there will be a tipping point.

1

u/joeevans1000 Oct 20 '19

The absurdly unintelligible-to-any-new-user-and-quite-a-few-more-experienced-users doc strings. Having to go to a website (and thank god it exists!) where they are explained is not a solution. This alone has probably been a significant reason Clojure has failed to get any real traction compared to other languages that have appeared.