3 ms·
I've never seen anyone put more than one namespace in a single file in clojure. I don't think the compiler would even understand that... While you can define
by DigitalJack 9y ago
I've never seen anyone put more than one namespace in a single file in clojure. I don't think the compiler would even understand that...
While you can define classes in clojure, it's not the common way to do things, and so namespaces take the role of classes insofar as compartmentalizing code.
It's not normal to operate on data in another namespace directly... you can do it, but it doesn't feel natural in the language. You do it through an interface (called a protocol in clojure), or through functions in that namespace. So in that sense, you are still using getters and setters for everything.
But yeah, there is a lot of freedom in clojure. And that favors the writer, not the reader. Hence it can be difficult to grok somebody's code if they are more comfortable using the more advanced features of the language.
- hellofunk 9y ago> namespaces take the role of classes insofar as compartmentalizing code Indeed! In fact, this is one of the sanest ways to do something resembling OO in Clojure.