6 ms·
A lot of great and capable languages are overlooked. The question is how do they overcome the opinion, hearsay and preferences that are louder than the truth?
by j45 15y ago
A lot of great and capable languages are overlooked.
The question is how do they overcome the opinion, hearsay and preferences that are louder than the truth?
Too few devs:
- truly give something 5 minutes before jumping to their foregone conclusion.
- admit that most languages with a decent capable and decent programmer are all, pretty equally equipped.
- every language + framework has it's pros and cons.
- dhaivatpandya 15y agoI didn't give Lisp 5 minutes; something I still regret (could have learned it so much earlier!)
- brnstz 15y agoGo has the advantage of being developed by Rob Pike and Ken Thompson. It also potentially has the marketing muscle of Google behind it, although the most I've seen so far is free stuffed Gophers at OSCON. Type safety, easy concurrency, static checking, C-like syntax, fast compilation time, concise syntax, etc. Java is ripe for replacing as the default language for (new) large systems. The replacement could be another language on the JVM, but I think Go has a good shot.
- ootachi 15y agoDepends what you mean by type safety. If by type safety you mean free from segfaults, Go is very much type-unsafe (send a map over a channel, access it concurrently, and it will segfault).
- drivebyacct2 15y agoMaybe I'm mistaking terminology but that doesn't seem like a type issue you're describing.
- ootachi 15y agoThere's no one definition of type safety. It ultimately depends on what your type system is trying to enforce. I strongly suspect, however, that most programmers expect "type-safe" languages to enforce memory safety, and that Go's lack of memory safety is surprising in this context.
- enneff 15y agoThat is a very unusual definition of "type safety." What you're describing is more commonly known as "thread safety," in my experience. By your definition, is Java type safe? You still need to guard against concurrent mutation of shared data in Java and in most other languages that support shared mutable state. We typically describe Go as "memory safe," in that you can't address uninitialized memory (unless you import package "unsafe", which clearly demonstrates your intent).
- ootachi 15y agoJava is type safe, because the language defines clear semantics for what happens when you mutate two memory locations simultaneously (you get one result or the other). Under no circumstances does the program have truly undefined behavior. Java HashMaps aren't thread-safe, but they will just do the wrong thing when you try to access them concurrently. Under no circumstances will the program be able to read or write undefined memory. By contrast, your Go program's behavior becomes undefined when you mutate and read a hashmap concurrently among multiple threads. Anything can happen. Edit (addressing the reply below): That's fascinating, thanks. It really speaks to the wisdom of writing hash maps in the library, on top of the language, rather than unsafely in the runtime as Go does. (This would unfortunately require generics, so it's not an option for Go.) It's very difficult to predict all that can go wrong with unsynchronized access to data structures that aren't designed to be thread safe. The beauty of Java here is that the core primitives can never lead to accessing undefined memory, and therefore hash tables, however badly they mess up, will never lead to that core principle being violated. This is critical for security, for example.
- smanek 15y ago
- enneff 15y ago> send a map over a channel, access it concurrently, and it will segfault Not exactly. Go's maps may safely be read from multiple threads simultaneously, but writing at the same time as reading or writing will yield undefined behavior. Go programs don't segfault like C programs. They typically panic, providing a descriptive stack trace of where the problem arose. As I mentioned in my other thread, what you're describing are "thread safe data structures," which Go doesn't provide by default. We provide the fast and non-thread-safe data structures and let the programmer build the concurrency mechanisms around them (easily done with a lock or using goroutines/channels).
- ootachi 15y ago"Undefined behavior" is the problem here. In Java, you can create data races, but you can't cause memory errors.
- canop_fr 15y agoWhat do you mean ? I you don't use synchronization protection when you access your structures from different threads, you'll have the same inconsistency in your data. Using the explicit Mutex of Go doesn't seem so different than creating an object on which synchronizing your blocks as you do in Java. Or do I miss something in your comment ? EDIT : In my opinion, a program that doesn't crash and goes on running with inconsistent data structures is mainly hiding a failure which will appear in a worse way later (for example when those data will be used). To fail fast is often more secure. But my opinion may be based on the fact that I see too many java programs which seem to work but that nobody can touch because they're just in the lucky state where bugs don't surface too much.
- ootachi 15y agoMutating a hash map in Java while another thread reads it won't cause bad things like: (a) memory you don't have access to to be read; (b) other threads to crash; (c) the VM state to be corrupted; (d) the GC to crash; and so on. The Java world is still in a consistent state. In a security-oriented world, this is important. To the reply: It's a bit pedantic for me to say this, I know, but that's still "a consistent state". Basically, a Java program can't do anything it wouldn't otherwise be able to do by modifying a hashmap concurrently. Java programs can go into infinite loops. They can't access uninitialized memory.
- sausagefeet 15y agoUnfortunately Go still lacks generics, something that will hinder it from being widely accepted from the Java/C# crowd, for good reason. There are some good arguments to be made for why Go's error handling is subpar as well that I think could disqualify it for a lot of people.
- lusr 15y ago5 minutes isn't fair. I took a look at http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=csharp&lang2=go http://shootout.alioth.debian.org/u64q/benchmark.php?test=al... first. OK so Go is about on par with Mono's C# performance and uses up to a 1/3 of the memory with code that is more concise. That's cool because it means I'm not sacrificing anything over the platform I specialize in (C#; although the last time I looked at the Alioth C# code I thought I saw some obvious improvements). I see there is a Go STOMP client for Apache Apollo, which means I can supplement the existing code in my current project without having to rewrite everything. So next I looked at: * http://golang.org/doc/go_tutorial.html http://golang.org/doc/go_tutorial.html * http://golang.org/doc/effective_go.html http://golang.org/doc/effective_go.html Way more than 5 minutes. Where are generics or do I have to learn some new construct? Wait a minute, is this thing object oriented or what? If not, why not? Do I have to learn some new philosophy? Already feeling a sense of dread having been through this game 10s of times before with other languages. I decided to research a bit to see if anybody else with a C# background had looked into Go. I found this, which confirmed my feelings that Go is for people who probably haven't given C# or Java a fair chance: http://www.jondavis.net/techblog/?tag=/c%23+vs+go http://www.jondavis.net/techblog/?tag=/c%23+vs+go . That's when I also discovered searching for 'Go' on Google is impossible because of the poor choice of name and decided I wasn't going to spend any more time on it, already being aware that aside from what looks like a total philosophy change (without it being clear whether it'll be worth it), I'm going to lose out on my awesome set of development tools (Visual Studio), years of C# experience and the HUGE .NET ecosystem, in exchange for what? Relatively unimportant performance advantages? At the end of the day, if performance/memory are issues I can just add more EC2 nodes to my architecture. At some point I'll hopefully make enough money to pay other people to worry about the technology. That being said I realize that as a developer who wants to be a manager/owner I'm probably in the minority of readers here.
- deleted 15y ago[deleted]
- adgar 15y agoIt seems you deleted your comment asking why you were downvoted. Here's why you were downvoted: > Way more than 5 minutes. Where are generics or do I have to learn some new construct? Wait a minute, is this thing object oriented or what? If not, why not? Do I have to learn some new philosophy? Already feeling a sense of dread having been through this game 10s of times before with other languages. If you didn't get past the fact that Go isn't object oriented, then you clearly didn't get very far into the language. And your resistance to "some new philosophy" shows you aren't interested in a new language with real ideas, but at most a different way to express what you already know and do while programming.
- ketralnis 15y agoYour points #2 and #3 are in conflict. Not all languages are equally equipped for the same tasks, which is what really matters. I wouldn't write a web application in bash any more than I'd write a batch file renamer in assembly and pretending that the programmer not being "decent" enough to make those things true is disingenuous