Hacker News new | past | comments | ask | show | jobs | submit login

Why is everyone making a big deal out of dynamic nature of Clojure as the main factor to not consider it in enterprise project ?

As if no dynamic language has ever succeeded in creating enterprise application which runs 24X7 !!!

If you don't like maps use clojure records

If you don't want free floating initiation or ambiguous variables and arguments to function in code, use type hints. Type hints may not be exact alternative but are good enough help in reading the code and especially compiling the code to native graal image or just providing enough information to JIT for optimization.

Use spec for generative testing and more detailed documentation. Irrespective of the language you use, tests are much important than types. Types help but they are not commandments.

Multithreading capabilities in clojure through standard library primitives exposed to achieve it are much better and safer than java.

For most of us, cost of immutable data structure is pretty reasonable. But if you think it's not the case, clojure provides mutable alternatives.

Use components like library to large code in depedancy inversion oriented style, if thats what you like. Personally I prefered dynamic dispatch through multimethods when I used to work in clojure 4 years back.

You can always get the library to do your job in the clojure ecosystem. If you don't find it, clojure provides easy integration with java libraries and you might be able to build a wrapper around it in couple of days if it is complex, in minutes otherwise.

To compare Clojure with languages like Haskell and its features, Rust and its features is utterly naive. Instead development team must strive for what actually is needed for job. Flexibility and discipline provided by language compiler and library eco system will always strike some kind of trade-off. Clojure is good trade-off for most applications including mission critical soft realtime application category.




The soft real-time interests me. Are there ways to avoid garbage as with java to minimize GC driven latency.


It's very much possible, now more than ever. New JDKs provide more efficient version of garbage collector like epsilon for example. CMS can also do the job if you know few tricks. You don't have to be a big nerd to understand them. Documentation is pretty helpful.

In my application I was able to get latency for http/rest services less than 15ms which also hit database more than once. Ofcourse it's very subjective to the business use case and networking infrastructure. YMMV

If you really want me to pin point the issue, as far as GC on JVM heap is concerned only major difference with other language implementation was that I had to use around 1GB of extra RAM.

All i am saying is that, start with idiomatic clojure. If that's not performant enough for you use case, start optimizing the code.


I assume you're referring to my comment, since I mentioned both Haskell and Rust.

_I_ am not capable of writing a robust, large scale application in a dynamic language. I do not have the discipline to second guess everything I do. I will at some point forget to write certain tests. Or test only the happy path. Or make a silly typo. Maybe I'll rename a keyword and in one place not notice that I'm renaming a keyword that will come from a completely different map. Or I'll forgot to namespace keywords and wonder where they come from.

I have no doubt that there are people who can write rock solid stuff in C, or Bash or Dash.

I can't. Therefore, yes, its dynamic nature is what leads me to rule out Clojure. I want to be lazy and focus on the logic, the algorithms and data structures. I do not want to be my own compiler because I'm not good at that.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: