Live data from Hacker News

Tour of our 250k line Clojure codebase

tech.redplanetlabs.com

121–130 of 237 posts

Re: Tour of our 250k line Clojure codebase

#121
post #119

> Our codebase consists of 250k lines of Clojure split evenly between source and test code. It’s one of the largest Clojure codebases in the world. Aren't there many Clojure projects out there, or is the language generally not used for large projects? I have a JavaScript frontend written in Vue that is 150k+ lines of code, without any tests. Which would be 25k lines of code more than they have, disregarding their tes…

At least according to Paul Graham, one of the appealing things about Lisp is the economy of expression. Not many Clojurists would brag about how big their code base is, I think.

http://www.paulgraham.com/popular.html

Re: Tour of our 250k line Clojure codebase

#122
post #37
post #30

Earlier quoted context omitted.

My understanding is that the company is a few years younger than Spec, but perhaps the code base is very very old.

Schema is a good library. Everyone seems to use spec today, but Schema easier to use than spec IMO. Spec is also still in alpha, with spec2 still under development.

We used clojure.spec in production for years. "Alpha" just means the API could change.

Re: Tour of our 250k line Clojure codebase

#123

Earlier quoted context omitted.

You're writing more code than you have to though. More code = more bugs.

I don’t agree there. Most of these extra classes are just type declarations with no methods at all. While the total LoC written might be higher, the amount of written logic in which you can introduce bugs is less.

I've caused myself a lot of problems by using/creating types that don't make sense. Coding myself into a corner. So I don't think it's fair to not count type declarations as code.

Re: Tour of our 250k line Clojure codebase

#124

Earlier quoted context omitted.

It's not difficult to write imperative code in Clojure; [1] is an example. Immutability-by-default makes you work to mutate things, for sure, but that in itself doesn't make the language inherently functional. [1] https://clojuredocs.org/clojure.core/let#example-542692c7c02...

Your link might be pointing to the wrong example. I assume you wanted to show an example of an atom.

Nope. The sequence of statements in the (let) block is imperative. Atoms are actually an example of how the values of references are updated functionally. Clojure has facilities for both imperative and functional style.

Re: Tour of our 250k line Clojure codebase

#125
post #41
post #29

Earlier quoted context omitted.

I've heard from investors that it is similar to Darklang. It certainly has the same goals, but dunno if it's the same approach in any way. Will be interesting to see

In that case, I wouldn't go near it with a ten foot pole.

what? nothing's perfect, but i thought darklang was kinda cool to the extent i messed around with it. i even did a couple toy "useful" things with it and found it pretty fun.

Re: Tour of our 250k line Clojure codebase

#126

> One of the coolest parts of our codebase is the new general purpose language at its foundation. Though the semantics of the language are substantially different than Clojure, it’s defined entirely within Clojure using macros to express the differing behavior. It compiles directly to bytecode using the ASM library. The rest of our system is built using both this language and vanilla Clojure, interoperating seamlessl…

I concur. I think it's nuts when companies do this. There's another well know SaaS that basically invented their own language but I can't recall who. It's the ultimate ego food for the lead engineer imho.

what a company needs is good leadership at every level. not unique tools, and not "10x engineers".

Re: Tour of our 250k line Clojure codebase

#127

> One of the coolest parts of our codebase is the new general purpose language at its foundation. Though the semantics of the language are substantially different than Clojure, it’s defined entirely within Clojure using macros to express the differing behavior. It compiles directly to bytecode using the ASM library. The rest of our system is built using both this language and vanilla Clojure, interoperating seamlessl…

I concur. I think it's nuts when companies do this. There's another well know SaaS that basically invented their own language but I can't recall who. It's the ultimate ego food for the lead engineer imho. what a company needs is good leadership at every level. not unique tools, and not "10x engineers".

Are you thinking of https://www.joelonsoftware.com/2006/09/01/wasabi/ perhaps?

Re: Tour of our 250k line Clojure codebase

#128
post #103

Earlier quoted context omitted.

Taken literally the claim isn’t true - a Turing complete type system can enforce any constraint that a Turing complete programming language can. But your everyday type systems typically can’t express concepts like “a list of at least 3 elements” or “a number which is a power of 2”.

Pardon my ignorance, but can this spec thing automatically deduce that 8^n evaluates to "a number which is a power of 2" or log(2, "a number which is a power of 2") is an integer? If yes, then I agree this is super helpful (and magical). If not, how is this different from a normal constrcutor (with runtime input validation)?

No, it's not automatic like that. You define predicate functions that need to evaluate to true to pass. One of the reasons this is better than a normal constructor is these predicate functions are attached outside of the function they're describing. So they're inspectable and composable.

Re: Tour of our 250k line Clojure codebase

#129

Earlier quoted context omitted.

I concur. I think it's nuts when companies do this. There's another well know SaaS that basically invented their own language but I can't recall who. It's the ultimate ego food for the lead engineer imho. what a company needs is good leadership at every level. not unique tools, and not "10x engineers".

Are you thinking of https://www.joelonsoftware.com/2006/09/01/wasabi/ perhaps?

oh yeh that's it!

a complete head case, nevertheless he's a million times more successful than I so perhaps I'm the one who's nuts.

Re: Tour of our 250k line Clojure codebase

#130

If I want to learn Clojure, where is the best place to start? I have a lot of experience with Python/Javascript now, and spent many years in C/C++/Objective C and Java. Also have some Go.

I personally started with this talk by Rich Hickey (person who made Clojure) https://www.youtube.com/watch?v=ScEPu1cs4l0

One of the best "why Clojure" talks that I've seen, especially for somebody coming from an OOP perspective, like myself.

Post reply on HN