News for hackers. Stuff that matters.
Re:Interview with Go’s Russ Cox and Sameer Ajmani by rdtsc on Thursday March 26, 2015 @03:46AM (#9268236)
> and Erlang/Elixir, which lack static typing.

From what I've seen over the last 10 or so years programming in both static (C++,Java,C#) and dynamic languages (Erlang, Python) things like "I got a string but expected an int" are pretty low on the list of what fails or brings a project down. Especially when it comes to distributed systems, thing like netsplits, logic and timing errors, mis-configuration, capacity overload are much more serious things.

Now you can argue static typing means really fast speed. And it is generally true. But lately with v8, PyPy and other such things that lines gets a bit blurry.

Re:Interview with Go’s Russ Cox and Sameer Ajmani by nostrademons on Thursday March 26, 2015 @04:25AM (#9268348)
In my experience - also using both static (C++, Java, Go, Sawzall) and dynamic (PHP, Python, Javascript) languages - I don't get type errors either. However, what actually brings dynamic languages down in larger systems is the time spent tracing through code to figure out what the actual type of the variable is, and hence what you can do with it. When a script is small this is negligible, but when you've got large teams and hundreds of source files, you can spend 10x the time doing this than actually coding.

I view static typing as essential to larger projects, but for documentation reasons, not performance. The performance and error-checking is a nice boon, but you can recover the former with smart VMs and the latter with unit tests. The documentation can only be recovered by writing your types out in comments, where they won't be checked by the compiler and invariably become out-of-date.

Re:Interview with Go’s Russ Cox and Sameer Ajmani by rdtsc on Thursday March 26, 2015 @10:10AM (#9269700)
You are right, it would help with documentation, good point.

In general I use integration and unit tests for checking breakage. And of course documentation is in comments but that is not forced. The first set of unit or integration tests also function as "example code". Even when reading documentation I usually gravitate to "examples" section quickly anyway.

I just had smaller components that are rather independent if I can. It depends on the project of course. I guess I've been doing micro-services before they were cool.

Re:Interview with Go’s Russ Cox and Sameer Ajmani by aquadrop on Thursday March 26, 2015 @04:49AM (#9268417)
Also, refactoring is easier - you just order to rename some method and all references are processed, you don't have to worry you missed something.
Re:Interview with Go’s Russ Cox and Sameer Ajmani by lumpypua on Thursday March 26, 2015 @04:46AM (#9268410)
> "I got a string but expected an int"

It's not initially that it's an issue. Refactoring is where static typing shines.

When you change an anonymous (or otherwise ungreppable) function that's passed around all over from taking a string to an int, it's great to have the compiler tell you that you really did find and fix all calls to the function.