News for hackers. Stuff that matters.
Re:Zygomys – An embedded scripting language for Go by mapcars on Thursday December 15, 2016 @04:56AM (#13183533)
What revolutionary exactly? Transducers?
Re:Zygomys – An embedded scripting language for Go by grabcocque on Thursday December 15, 2016 @05:03AM (#13183556)
Transducers and Spec are two great examples of what Clojure's community is best at. There's a practicality of purpose and single mindedness of philosophy at play in the language's evolution here. Making simple easy.

To my mind though, Clojure brought clarity to the JVM on issues of concurrency, state, mutability, object orientation and persistence and for that I will always love it.

Re:Zygomys – An embedded scripting language for Go by pjmlp on Thursday December 15, 2016 @06:51AM (#13183949)
Transducers were already in Common Lisp in 1989,

https://www.reddit.com/r/Clojure/comments/3tha86/transducers...

Likewise Spec ideas are not new to old timer Lispers, many forms of Lisp type annotations are similar to it.

What Clojure has brought was making those ideas "modern" again.

Re:Zygomys – An embedded scripting language for Go by pron on Thursday December 15, 2016 @07:23AM (#13184083)
Isn't the idea that all mutation must either be local or transactional rather revolutionary? In a sense, Erlang is like that, too, but Clojure took the idea much further. It is pretty clear that that's Clojure's the main idea.
Re:Zygomys – An embedded scripting language for Go by pjmlp on Thursday December 15, 2016 @08:19AM (#13184358)
No, because those ideas can be tracked down to Miranda or even early probably, when digging into enough SIGPLAN papers.

What might be revolutionary is making more "common programmers" aware of them.

Re:Zygomys – An embedded scripting language for Go by pron on Thursday December 15, 2016 @11:26AM (#13185718)
Isn't Miranda pure-functional? Because Clojure is imperative (-functional). Saying you can't mutate is very different from saying you can mutate whatever you like, whenever you like, as long as its transactional or not observable.

And SIGPLAN papers don't really count. A revolutionary product is not the same as a revolutionary idea. Implementing ideas that have never been productized is still revolutionary.

Re:Zygomys – An embedded scripting language for Go by jerf on Thursday December 15, 2016 @09:08AM (#13184610)
Erlang is a fully immutable language. Haskell's more the one where things are either immutable or strictly contained in some scope.
Re:Zygomys – An embedded scripting language for Go by pron on Thursday December 15, 2016 @11:35AM (#13185803)
If I'm not mistaken, ETS tables allow the same kind of mutation as Clojure's atoms -- i.e., they are atomic, but still mutations. Haskell is pure-functional, which is something very different from the functional-imperative Clojure and Erlang.
Re:Zygomys – An embedded scripting language for Go by jerf on Thursday December 15, 2016 @02:11PM (#13187245)
"If I'm not mistaken, ETS tables allow the same kind of mutation as Clojure's atoms"

ETS tables are usually out-of-(Erlang-)process. You are sending messages to them to update them and query them, and those processes are each functional, so it's still functional. IIRC there's a mode where it runs "in process" with you, but it's still conceptually behind the same interface. (Which raises interesting questions about what exactly is "mutable" or "not mutable", which IMHO ultimately get best answered by Rust.)

What Erlang is not is pure. You can query an ETS table, send it a command to mutate, then run the exact same query again and get a difference response. The message passing makes things impure, even though every individual component of the system is immutable-functional. And there are some other impure functions in Erlang as well, of course, like the functions to get the current time, but the message passing is in some sense the fundamental introduction of impurity at the architectural level.

Re:Zygomys – An embedded scripting language for Go by pron on Thursday December 15, 2016 @04:00PM (#13188344)
> The message passing makes things impure, even though every individual component of the system is immutable-functional.

That's how you think about it, but allowing mutation and allowing blocking interaction with processes are exactly the same, as blocking interaction with processes is the same having as continuations, and continuations alone are all you need for mutation, even if you imagine things to be immutable. Like monads, continuations are a universal effect. An otherwise pure language with continuations is indistinguishable from an imperative language, i.e., it is imperative.

Both Clojure and Erlang are functional-imperative languages, but unlike other imperative-functional languages (like ML), they have been designed with concurrency in mind, and the mutations they support are transactional (or at least atomic(.

Re:Zygomys – An embedded scripting language for Go by fnordsensei on Thursday December 15, 2016 @05:34AM (#13183657)
It's also spawned the recent interest in immutability. Via Om it's had a considerable effect on how Facebook has developed React and its ecosystem, for example.
Re:Zygomys – An embedded scripting language for Go by eternalban on Thursday December 15, 2016 @07:43AM (#13184181)
> Clojure brought clarity to the JVM on issues of concurrency, state, mutability, object orientation and persistence

Hyperbole much?

Re:Zygomys – An embedded scripting language for Go by fmjrey on Thursday December 15, 2016 @01:28PM (#13186849)
To me the most important contribution of Clojure is to not focus on OO or FP at all, but instead on data.

Data is a first class citizen of the language: data literal is part of its syntax, and it uses powerful persistent data structures behind that.

Programming with Clojure is what has made me realise that data is really what matters after all. None of that FP or OO discourse should deviate us from that reality check that computing is all about data-in/data-out. Pull the plug and/or battery of your computer and see what remains next time you power it up.

So yes, Clojure may not be revolutionary in itself, it does rely on the shoulders of giants. It is however setting a new standard in terms of being successful in bringing together a very well thought out set of features and philosophy to bring the focus of programming back towards the real complexity, instead of the accidental one created by how we think.

Re:Zygomys – An embedded scripting language for Go by hellofunk on Thursday December 15, 2016 @01:46PM (#13187011)
This is well said.

I wrote Clojure full-time for a few years. I was lucky to do so and get paid to learn such an interesting language and paradigm of software development.

Aside from the points you mention, of which I agree, there is one other point I took away from the experience that many would disagree with: I really, really missed static typing.

So that's the main reason I don't use Clojure as much any more and went back to other languages with a different model of typing. But I learned so much and it changed the way I work in other languages.

Re:Zygomys – An embedded scripting language for Go by hellofunk on Thursday December 15, 2016 @05:48AM (#13183713)
Clojure is an interesting intersection of two ideas: Lisp, and pure functional programming.

It is not pure, but it is much closer to this than other lisps and it is immutable by default with efficient functional data structures. CL and Schemes are not this way.

Re:Zygomys – An embedded scripting language for Go by harperlee on Thursday December 15, 2016 @05:06AM (#13183561)
I think a revolutionary aspect of it is not a technical one but a social one: is has destygmatized lisp a lot, and lots of people are jumping to it.

Source: I played for a while around 2008 with common lisp and web apps, and while the tooling (hunchentoot, elephant, etc.) was solid, my completely subjective assessment was that the community languished and it was very hard for newbies.

EDIT: Why was I downvoted? Explanations enable enhancement more than punishment... Is it for the reddit-like "source:"? I really dont get it.

Re:Zygomys – An embedded scripting language for Go by Sean1708 on Thursday December 15, 2016 @04:31PM (#13188619)
One or two downvotes is just statistical noise, don't let it get to you.
Re:Zygomys – An embedded scripting language for Go by amelius on Thursday December 15, 2016 @05:35AM (#13183661)
Clojure may be revolutionary, but the fact that it can't be compiled to run on other runtime systems (e.g. Go) is a bit of a disappointment.
Re:Zygomys – An embedded scripting language for Go by pjmlp on Thursday December 15, 2016 @06:53AM (#13183961)
It is a matter of implementation and tooling, not language.

Anyone is free to create a native AOT compiler for Clojure.

In fact many attempted to do so, but have given up due to the effort it means bringing a full eco-system up to speed to what Clojure already enjoys in JVM, .NET and JS runtimes, libraries and tooling.

Specially in quality of generated native code and GC implementations.

Re:Zygomys – An embedded scripting language for Go by bad_user on Thursday December 15, 2016 @05:58AM (#13183752)
Clojure can compile to Javascript and .NET, so that's 3 major platforms, being among the most portable languages available.

That it doesn't compile to Go, that's because Go isn't a good compilation target. Besides being a subpar language that ignored the last 30 years of research at least, it wasn't designed to be a platform for other languages. If you're looking for disappointments, you aren't looking in the right direction ;-)

Re:Zygomys – An embedded scripting language for Go by amelius on Thursday December 15, 2016 @06:06AM (#13183782)
> Besides being a subpar language that ignored the last 30 years of research at least

That is not really fair. As an example, Clojure itself is dynamically typed, which means it ignores a large chunk of research itself.

Re:Zygomys – An embedded scripting language for Go by pron on Thursday December 15, 2016 @07:19AM (#13184066)
> Clojure itself is dynamically typed, which means it ignores a large chunk of research itself.

It does not. PL research is about how to construct type systems if you choose to construct them. There's plenty of research in untyped languages, too (for a recent, pretty exciting example, see Dedalus, which is the language semantics at the core of Eve).

Re:Zygomys – An embedded scripting language for Go by StevePerkins on Thursday December 15, 2016 @07:56AM (#13184243)
In other words:

(1) "I love functional programming! Therefore, newer languages that aren't following in the mold of Haskell are conceptually antiquated."

... yet...

(2) "I don't care about static typing. Therefore, it's cool to ignore the trend of most major languages moving in that direction over the past decade."

Then of course the Rust and Swift guys would tell you that Clojure is an anachronism for relying on garbage collection. Etc, etc...

All of these trade-offs, at the level on which they're commonly discussed on HN and other forums, are matters of subjective preference. And that's okay. Disrespecting other communities for their subjective preferences, while trying to give it the objective veneer of "You've ignored the latest 'advances'!", is just pretentiousness.

Re:Zygomys – An embedded scripting language for Go by steveklabnik on Thursday December 15, 2016 @09:37AM (#13184781)
> of course the Rust and Swift guys would tell you that Clojure is an anachronism for relying on garbage collection.

I assure you, we would very much not. (The Rust team, anyway. I haven't seen that kind of nonsense out of the Swift team either, and it'd make even less sense, as Swift is technically garbage collected.)

Re:Zygomys – An embedded scripting language for Go by pron on Thursday December 15, 2016 @08:25AM (#13184384)
I absolutely agree with the silliness behind "you've ignored the latest advances!" and I also know that the latest advances in research very often yield no advances in practice. I also agree that mocking other languages is usually a sign for having little experience with many project and team types, and with not being able to see the bigger picture.

But that doesn't mean that you can't discuss the tradeoffs, or that they're just subjective preferences. Someone who really understands Rust would never say that GCs are an anachronism, as they would be very much aware of the cost Rust pays for the ability to maintain safety when a GC can't be used. But that's not a subjective preference, either. A language like Rust knowingly sacrifices convenience and development speed to be able to target certain kinds of applications.

Re:Zygomys – An embedded scripting language for Go by jlg23 on Thursday December 15, 2016 @06:34AM (#13183881)
> Besides being a subpar language that ignored the last 30 years of research at least

Can beef that up with some arguments? The creators of Go are not ignorant, they just decided consciously to create a language easy enough for recent graduates to be productive quickly.

From a science point of view, the only valid reason why clojure cannot compile to Go is that nobody cared to implement that.[1] Well, either that, or the people who considered doing that realized that compiling a programming language to a Chinese board game is equivalent to using an abacus and abandoned the idea .... ;)

[1] https://en.wikipedia.org/wiki/Turing_completeness

Re:Zygomys – An embedded scripting language for Go by IshKebab on Thursday December 15, 2016 @06:33AM (#13183877)
> ignored the last 30 years of research at least

Please. They didn't ignore the research they just decided against it. You might say that they were paying more attention to the last 30 years of experience.

Re:Zygomys – An embedded scripting language for Go by Ar-Curunir on Thursday December 15, 2016 @07:20AM (#13184072)
They still made the null mistake. Their experience clearly wasn't enough.
Re:Zygomys – An embedded scripting language for Go by talideon on Thursday December 15, 2016 @10:43AM (#13185311)
The right solution would've been to go for algebraic data types or at least nullable types. The justification for not going down the former route was that they overlapped too much with interfaces, which is a justification I'm not exactly convinced by. Algebraic data types would make error handling in Go a heck of a lot more pleasant to boot.
Re:Zygomys – An embedded scripting language for Go by Ar-Curunir on Thursday December 15, 2016 @04:30PM (#13188611)
Yes, but that would involve looking at the last 30 years of PL Research, which the parent claims they chose nebulous "experience" over.

I get that that the inventors of Go are respected people, but even they can mistakes.

Re:Zygomys – An embedded scripting language for Go by mapcars on Thursday December 15, 2016 @07:33AM (#13184127)
It's funny that you think supporting 3 platforms is "portable". Check this out:

http://sbcl.org/platform-table.html

http://www.rebol.com/release-archive.html

Re:Zygomys – An embedded scripting language for Go by jjnoakes on Thursday December 15, 2016 @08:27AM (#13184404)
He said 3 platforms, but he meant (and listed, so the meaning was obvious) 3 languages, some of which are indeed portable to a very large number of platforms.
Re:Zygomys – An embedded scripting language for Go by sanxiyn on Thursday December 15, 2016 @05:38AM (#13183668)
Clojure can be compiled to run on other runtime systems. ClojureScript exists.
Re:Zygomys – An embedded scripting language for Go by mapcars on Thursday December 15, 2016 @05:56AM (#13183742)
Correct me if I'm wrong, but ClojureScript is implemented from scratch and independently of "big" Clojure. If it is so - to run Clojure on other systems you have to implement everything, which makes no sense at all.
Re:Zygomys – An embedded scripting language for Go by kimi on Thursday December 15, 2016 @06:30AM (#13183867)
I find it quite annoying that for a language that is meant to be "parasitic" there is no simple way to port it to any target. There are a few Clojures around that target e.g. C, but they are more "lookalikes" than the real thing. And ClJS is a separate codebase.

It would be cool if Clojure was one and the same thing and then had a backend to support generic platforms - this way you would have ClojureJVM, ClojureNET, ClojureGO, whatever, with different levels of support and speed, but at least you could share the code. For example, maybe the Go version could have only :aot and write Golang sources.

Re:Zygomys – An embedded scripting language for Go by pjmlp on Thursday December 15, 2016 @06:55AM (#13183967)
Well it only got reader conditionals in 1.7 and most libraries don't bother to use them yet, afaik.
Re:Zygomys – An embedded scripting language for Go by amelius on Thursday December 15, 2016 @05:39AM (#13183680)
Yes, but all your tools and libraries break. You have to be prepared to exchange one ecosystem for another.
Re:Zygomys – An embedded scripting language for Go by harperlee on Thursday December 15, 2016 @05:54AM (#13183738)
Mmmh yeah but what is the alternative? To not have access to the JVM ecosystem?

You could make an analogous argument for C not being portable, since it uses an ecosystem of tools and libraries that might not be portable to all systems.

Re:Zygomys – An embedded scripting language for Go by amelius on Thursday December 15, 2016 @06:08AM (#13183790)
The alternative is that the ecosystem itself is written in Clojure (or at least the most important parts of it).

Of course, you will always have a set of points at which the language needs to call lower-level functionality, but you should keep that set as small as possible, to make the ecosystem easier to port.

And in the modern "client/server" world, you really need this, because systems are often heterogeneous, and you often need to move one piece of code to another part of the system which runs on a different runtime.