News for hackers. Stuff that matters.
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by dustingetz on Sunday January 06, 2019 @06:55PM (#18841575)
Never used Lisp, but huge Clojure user, the real innovation is the immutable data structures:

RICH HICKEY: Ok, so, problem number one on that list was place oriented programming. Absolutely, this is the problem. Almost all the programs I wrote, lots of the things on that list were multi-threaded programs, you know, they're crazy hard in C++. Just impossible to get right, when you adopt a normal mutability approach, you know, mutable objects. So, this is the number one self-inflicted programming problem. It seemed, you know, clear to me that the answer was to make functional programming and immutable data the default idiom. So the challenge I had was, were there data structures that would be fast enough to say, "we could swap this for that". And the objective I had, the goal I had was to get within 2x for reads and 4x for writes. And I did a lot of work on this, this was actually the main research work behind Clojure, was about these persistent data structures. Eventually I found...you know I looked at Okasaki's stuff and, you know, the fully functional approach and none of that gets here. And then I found Bagwell's structures were not persistent, but I realized could be made so, and they just have tremendously great characteristics combining the persistence with the way they're laid out, the way memory works. They made it. They made this bar, and I was able to get my friend to try my programming language. You know, we (?) have large library of pure functions to support this, and, you know, immutable local bindings. Basically if you fall into Clojure, your first hurdle is not the parentheses, right? It's this, this functional paradigm, everything is gone, there's no mutable variables, there's no state, there's no mutable collections and everything else, but there's a lot of support, there's a big library. You just have to, you know, sort of learn the idioms. So I think this was straight-forward, the critical thing that's different about Clojure is, by the time I was doing Clojure, the people who invented this stuff had adopted a lot more, right? I think most of the adherents in the functional programming community considered functional programming to be about typed functional programming, statically typed functional programming is functional programming. And I don't think so, I think that this is, you know, this falls clearly in the 80/20 rule. And I think the split here is more like 99/1. The value props are all on this side, and I think Clojure users get a sense of that, they get a feel for that. This is the thing that makes you sleep at night.

https://github.com/matthiasn/talk-transcripts/blob/master/Hi...

Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by xiaq on Sunday January 06, 2019 @07:26PM (#18841730)
On top of persistent data structures, I find the main innovation of Clojure is the way it mixes functional programming with dynamic typing into its unique paradigm:

a) Data is just data, divorced from behaviors, and functions (not methods) manipulate data. This is really just old-school functional programming.

b) Data is represented by hashmaps, and are extensible - if the data gets richer over time (= more keys in the hashmap), functions that used to work on the previous, poorer data still work on the new, richer data. In other words, each key of a hashmap is automatically an interface, and data satisfies interfaces depending on which keys they have (structural typing).

Now, this interface mechanism is a bit sloppy if keys are just string identifiers, but this is overcome by namespacing keywords (which has its own syntax, ::keyword), thus removing the risk of the same name being used for different purposes. This idea is most clearly articulated in the core.spec library, which encourages you to establish a 1-to-1 relationship between a (namespaced) keyword and a spec (https://clojure.org/guides/spec#_registry).

Previous dynamic languages have always used hashmaps to represent data, either directly or indirectly. But once in the land of high-level abstractions, they would revert to "canonical" Java-style OOP (Python and ES6 being the most notable examples). Clojure seems to be the only mainstream-ish language out there that uses -- or at least aspires to use -- hashmaps as a real abstraction mechanism rather than a convenience.

Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by sswezey on Sunday January 06, 2019 @10:23PM (#18842522)
Have you ever looked into Lua? Lua uses their tables (hash maps) for everything. It is a prototypical language similar to Javascript and everything is a key in the table. The language provides syntactic sugar for certain accessors such as `table.x` translates to `table["x"]` to make it seem like a more traditional OOP language.
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by aidenn0 on Sunday January 06, 2019 @10:02PM (#18842436)
Everything you say is not new to lisp though.
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by reitzensteinm on Sunday January 06, 2019 @07:16PM (#18841677)
I would go as far as to say that a language with more traditional syntax (for instance Python style) with pervasive immutable data structures would do very well. Few of the benefits Clojure brings to day to day development seem to require a lisp syntax.
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by dustingetz on Sunday January 06, 2019 @07:27PM (#18841736)
Maybe – s-expressions have a killer app though, which is that they are so simple that the level of effort to port Clojure to other platforms (ClojureScript, Clojure CLR, etc) is within reach of one person. I am irrationally bullish on Clojure, but this is the key to the bet – platform reach has network effects which I believe may outweigh in longrun the resistance to alien syntax. My Clojure codebase (http://www.hyperfiddle.net/) runs on JVM, node, browsers, lambdas, and inside Datomic cluster as stored procedure. Same code! Same library artifact! Simultaneously targeting all these different platforms!
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by int_19h on Sunday January 06, 2019 @09:54PM (#18842392)
> which is that they are so simple that the level of effort to port Clojure to other platforms (ClojureScript, Clojure CLR, etc)

I don't see why that would be at all relevant to porting to other platforms? Most languages with richer syntax would parse to a backend-independent AST first, and so porting to a new platform would not require touching the parsing code at all - you'd be working on the same level as S-exprs, effectively.

Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by dustingetz on Sunday January 06, 2019 @10:13PM (#18842481)
the s-expressions make the compiler simple. Clojure the language was designed to make portability simple. you need both
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by int_19h on Monday January 07, 2019 @04:01PM (#18850019)
A well-designed grammar isn't difficult to parse into S-expressions. And they were writing compilers for languages with rich grammars (e.g. Algol-60) back in 1960s - often in hand-written assembly, on punch cards! I think a claim that it makes the implementation overly complex strains credulity.
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by drcode on Sunday January 06, 2019 @08:52PM (#18842129)
I'm definitely as hardcore of a clojurist as you can be, but I would NOT call myself "bullish" on clojure: Certainly, for those of us familiar with the language it's an awesome tool, but clojure definitely is not the "hot new thing" anymore and new user adoption I think is declining in recent years, for reasons that have little to do with intrinsic properties of clojure.
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by dustingetz on Sunday January 06, 2019 @09:34PM (#18842297)
i track clojure growth metrics, it is definitely not declining, and the killer apps have yet to reach market. Python was dominating Ruby at the 10 year mark, and then Rails happened. the metric i cherrypick to try to measure disruption is how many edge innovators an ecosystem attracts, and Clojure aces this. React.js is one of few great innovations that came out of Javascript, and even virtual dom I saw first in ClojureScript at your talk Webfui at Conj 2013!
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by dustingetz on Monday January 07, 2019 @08:06AM (#18844792)
oops, Webfui was 2012, React.js was 2013
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by reitzensteinm on Sunday January 06, 2019 @07:36PM (#18841790)
All platforms could share the same syntax->s expression desugaring code, so I'm not sure why that would matter.

The difference Clojure has is that the core language is tiny, but you could do this with an alternative syntax as well. You'd just need macro support, even if they're more clumsy to write.

(I literally have an editor open working on a Clojure compiler as I write this, so I don't disagree with your premise).

Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by int_19h on Sunday January 06, 2019 @09:55PM (#18842396)
Better yet, a new syntax for this language, like Reason is to OCaml.

(or the original M-expressions for Lisp)

Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by fiddlerwoaroof on Monday January 07, 2019 @01:38AM (#18843264)
My experience starting to work with lisps was similar: I thought "this is a great language, if only it had a nicer syntax" and I played with things like https://readable.sourceforge.io to try to make writing lisp more like writing my favorite language at the time (Python). After a while (and especially once I learned how to use paredit effectively), something changed and I realized that the s-expression syntax was exactly the syntax that I wanted.
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by int_19h on Monday January 07, 2019 @03:59PM (#18850002)
Nevertheless, there's a strong argument to be made that unwieldy syntax is at least part of why Lisp-like languages aren't as popular as competitors, with syntax being the only seemingly consistent difference. And it seems particularly relevant to Clojure, given that it's otherwise very un-Lispy in many respects (e.g. cons cells are not the end-all be-all), and closer to other modern languages.
Re:How innovative is Clojure as a Lisp dialect from Lisp exp... by macintux on Sunday January 06, 2019 @08:26PM (#18842025)
Elixir?