News for hackers. Stuff that matters.
Re:Data notation in Clojure by janetacarr on Thursday July 01, 2021 @09:23PM (#27706925)
I might be old school, but I thought the whole point of EDN was it's something of a JSON alternative.

As for macros, speaking from experience, I think custom macros are rare because there are only three real use cases: First, was to reduce duplicate code. Second, was to extend the language if it was missing a feature. Third was to prevent expansion of some form (ie logging out a infinitely expanding form). It's a hard syntax to grasp sometimes with all the `~@form type stuff. I used to chastise developers on our team for writing macros because they would often write macros that really did none of those (like a custom thread-> macro). They are pretty _fun_ to write though! :)

Edit: I wanted to add some more thoughts to this. I also think the lispyness of Clojure is overplayed to the end developer, but a large amount of the Clojure core language forms are macros (and, or, ->, for, etc). I'm speculating here, but I'm guessing it was how the Clojure core language became relatively less verbose than other lisp dialects.

Re:Data notation in Clojure by jwdunne on Friday July 02, 2021 @04:14AM (#27709020)
Funnily enough, I just finished reading this:

https://download.clojure.org/papers/clojure-hopl-iv-final.pd...

Rich Hickey goes into detail how he designed and implemented Clojure. One thing that stood out was a focus on a really small, conservative core, where the vast majority of clojure’s features are implemented as libraries, based on a small, core language. Other languages would need to extend the syntax to achieve the same.

A great read, and I don’t program Clojure in any respect, but I do want to after reading it.

Re:Data notation in Clojure by geokon on Friday July 02, 2021 @10:20AM (#27711846)
Thanks for the link. I'll take a read when I have some time :)

If there is a small core, it's not necessarily obvious. Yes, a lot of things are pushed out to libraries, but even the basic language features, liked (defn) (cond) (ns) threading etc. - are all implemented through macros. There is prolly a small subset of the language is which is actually made of language primitives implemented in Java or JS. From a language development point of view this probably makes life much easier. And if you wanted to port Clojure to a different backend then that'd probably be much easier than a language where syntax is added more explicitly. There is a design elegance to it, but as a language user it really makes no difference if a feature is a macro or language primitive. I mean to say Clojure isn't big, but it's not some barebones Scheme-y thing either. It probably has a Scheme-y core, but you'd need to root around to find it