4 ms·
> I'm not so sure about that. If I'm not mistaken, most Go objects are mutable and can still be passed as messages. This is actually a complex subject. Go has
by zaphar 14y ago
> I'm not so sure about that. If I'm not mistaken, most Go objects are mutable and can still be passed as messages.
This is actually a complex subject. Go has mutable objects yes. But it also doesn't treat everything like an reference type. You have to send a pointer as the message if you want the receiver to be able to modify the object you sent. (slices and maps are the exception to this) I actually don't think immutability is as key to concurrency as it gets hyped to be. Clojure which I've used and enjoyed does tend to get in your way with the immutability by default.
This to me makes Clojure less relaxing. In fact Clojure is not relaxing it's challenging which can be enjoyable but I wouldn't say it's what I want to do everyday for my job. Go I could easily see myself doing it everyday.
As I said Go has a lot of good qualities all in one package. Clojure has some of those qualities but not all of them.
The pointer to the compiler api is interesting. I hadn't seen it before. I don't see any way to serialize a source tree in there but that might be just for lack of searching. I wonder why things like gofmt and company don't exist in the java toolchain already. I mean outside of third party IDE's.
- pron 14y agoAlright, I'm sure some people find Go's particular combination of features appealing. For me, a language has got to be so unbelievably awesome to consider leaving the JVM, and seeing that some of the most awesome languages target the JVM, that language better do something that would truly impress a veteran like me. There's only one non-JVM language that I'll use for some very specific applications, that I think is all that: Erlang.
- cgag 14y agoI'm not sure if it's just a mindset thing or the stuff I've used it for, but I've never felt the immutability got in the way, it's one of the things I miss most when using other language.
- dizzystar 14y ago>> * I actually don't think immutability is as key to concurrency as it gets hyped to be. Clojure which I've used and enjoyed does tend to get in your way with the immutability by default.* I don't want to join into a language war, but I wanted to point out two things with this statement: 1- I can show you video lectures from 1985 that discuss mutability -vs- immutability in concurrent systems. Immutability won this war, at least in the research realm, 30 years ago. 2- Rich Hickey worked on massive telephone systems and created Clojure, at least in (large) part, out of frustration of dealing with mutation. So there's a long line of research backed by "real world" experience showing mutation not holding up well for concurrency. Erlang is another example. Regardless, I do agree that immutability may not be what it is hyped up to be, especially if you are looking for the mythical silver bullet, but it most certainly isn't over-hyped if you compare it to mutation, and the ideas are still quite young and being tested. Give it 20 years and I suspect there will be another paradigm shift at some point.
- zaphar 14y agoMy point is that Go gives you the option of immutability. Not immutability or something in between. I frequently send messages using non reference types which incurs a copy but means that I don't have to worry about who owns this code. It's easy since Go has pointer and non pointer types. Java has reference types and you have to design the object to be immutable by hiding fields behind methods and using annotations. Clojure goes to the other extreme. Go sits in the middle. Which is relaxing.
- jasonjackson 14y agoGo can't do immutable updates efficiently (yet) because it doesn't have a persistent data structure implementation for vectors, maps, sets, etc.
- Evbn 14y agoJava has a keyword 'final' for immutable objects.
- laureny 14y ago> 1- I can show you video lectures from 1985 that discuss mutability -vs- immutability in concurrent systems. Immutability won this war, at least in the research realm, 30 years ago. Maybe, but concurrency based on mutability seems to have won this war in the real world these past thirty years. Immutable systems might be easier to design in theory but we haven't seen this proven in the battle field yet, and the fact that most of the concurrent code today runs on mutable structures shows that it can be done.
- DennisP 14y agoImmutability has worked out really well for a lot of real-world systems built with Erlang.
- laureny 14y agoThe main (and close to only) user of Erlang was Ericsson, and here is what the Wikipedia has to say about it [1]: "Shortly thereafter, Erlang was banned within Ericsson Radio Systems for new products, citing a preference for non-proprietary languages. The ban caused Armstrong and others to leave Ericsson" Not exactly a strong endorsement for Erlang. [1] http://en.wikipedia.org/wiki/Erlang_(programming_language) http://en.wikipedia.org/wiki/Erlang_(programming_language)