News for hackers. Stuff that matters.
Re:Why We switched from Python To Go by unscaled on Sunday April 09, 2017 @09:44AM (#14072232)
> It's really weird to see one of the reasons for their switch to Go was because it's a statically typed language. If you want static typing, you don't choose Python in the first place. You know it beforehand and it shouldn't come as a surprise for you.

It's weirder that many Python/NodeJS switchers cite this reason, since out of all the commonly used statically typed languages, Go has the second weakest type system (the first place obviously Goes to C).

With so many methods returning an interface{}, you'll get exactly the same crashes you had with Python.

If type safety is really such a major issue for you, you'll get a significantly better deal from Python Type Hints (using mypy or PyCharm) and TypeScript/Flow. All of them support generics (and hence nearly eliminates the need for wildcard types).

I suspect performance and static binaries are the real reason for most of the cases of projects switching from dynamic languages to Go.

Re:Why We switched from Python To Go by uluyol on Sunday April 09, 2017 @11:09AM (#14072629)
What functions return interface{}? I rarely see it outside of marshaling/unmarshaling (where I believe it would remain even if the language had real generics) and contexts (which would also use interface{} if there were generics).

Sometimes you want dynamic typing, how else will you pretty print structs? The compiler could generate code but that's a lot of bloat. For context, the point of it is that you don't know what's in it, it's an opaque container for information to be used by middleware. The fact that data might be missing lends itself to easier refactoring later on.

I want generics in go, but I don't find my code using much interface{} at all.

Re:Why We switched from Python To Go by bastawhiz on Sunday April 09, 2017 @01:17PM (#14073288)
It really depends on the type of application you're building, I suppose. I've seen applications littered with empty interfaces, and others with hardly any.
Re:Why We switched from Python To Go by yummyfajitas on Sunday April 09, 2017 @10:30AM (#14072462)
If you really want good static typing while being fairly python like, there are other great options. Java or c++ both have decent generics, speed comparable to go, great libraries and years of collective experience using them.

I truly hate the social hacks that are causing go to displace much better languages.

Re:Why We switched from Python To Go by nine_k on Sunday April 09, 2017 @11:16AM (#14072669)
It's the learning curve. If you know another imperative language, you can grasp golang in a week. With C++ or Java, you need months.
Re:Why We switched from Python To Go by SamReidHughes on Sunday April 09, 2017 @02:40PM (#14073694)
Java is pretty darned graspable, at least I think it's way closer to Go than C++. What do you think are the biggest things that make it hard? The language? Warts like int/Integer? Library size or organization? (This is a real question, I can't look at this stuff with "fresh eyes.")
Re:Why We switched from Python To Go by thomastjeffery on Monday April 10, 2017 @12:08AM (#14075940)
For me? The environment/runtime.

I can write a simple program in C/C++/go/rust/etc, and compile and run it.

In Java, a bloated IDE isn't just a recommendation, it's practically a requirement.

Evey time I try to learn Java, I smack my head against the toolchain. I ended up just giving up when I tried to wrap my head around classpath, and haven't tried since. I could probably figure it out pretty easily now, but I just don't see any allure in learning Java anyway.

One of these days, I might start using Clojure, but the JVM just feels so messy that I don't want to start.

Re:Why We switched from Python To Go by yummyfajitas on Monday April 10, 2017 @12:24AM (#14076006)
There is no requirement to use an ide in Java. I've never written Java in anything other than emacs and never had a problem.
Re:Why We switched from Python To Go by thomastjeffery on Monday April 10, 2017 @01:22AM (#14076255)
I'm likely overstating the problem, but that is my experience as I remember it.

My main point is that Java just isn't appealing enough in the first place for me to want to deal with the relatively insignificant issues I ran into.

Re:Why We switched from Python To Go by thomastjeffery on Sunday April 09, 2017 @11:52PM (#14075866)
> much better languages.

I disagree. Java has a bloated syntax, and C++ is a mess. Java also depends on a proprietary runtime, with mostly compatible free alternatives.

The biggest advantage C++ offers is speed, through memory management, which is usually a pain to deal with.

Go, on the other hand, has a well thought out syntax, good support for concurrency, garbage collection, and compiles to native executables.

Re:Why We switched from Python To Go by yummyfajitas on Monday April 10, 2017 @12:28AM (#14076020)
Could you illustrate what you mean by "bloated syntax"?

Everything else you mention (besides native executables) Java also has. From what I can see, Java provides far better concurrency support - more paradigms than simply go routines.

Re:Why We switched from Python To Go by thomastjeffery on Monday April 10, 2017 @01:32AM (#14076303)
Classes are required. Sometimes I just want a c-style program without a class. Java looks a lot like C++ (just with garbage collection, and some more consistently defined behavior). In comparison, golang (and rust) have some nice syntactical differences: inferred types, postfix type annotations, etc.

Go routines are nice when that is all the complexity you want. Having more paradigms isn't an interesting prospect until it becomes specifically useful.

Java may be more usable in many cases, but it, in my experience, just isn't easy to work with.

Re:Why We switched from Python To Go by yummyfajitas on Monday April 10, 2017 @05:26AM (#14077077)
Apart from the boilerplate enclosing class (4 lines, vs 2 in C), you can write a C-style program without classes in Java. There is literally nothing stopping you and generics are helping you significantly for this.
Re:Why We switched from Python To Go by thomastjeffery on Monday April 10, 2017 @04:19PM (#14082174)
That's completely true, but I just don't like the boiler plate. It's not hugely important to the grand scheme of things, but the more barriers I have from writing a function to running code, the less I want to deal with the toolchain/language in the first place.