News for hackers. Stuff that matters.
Re:Four days of Go by smt88 on Wednesday April 22, 2015 @12:25PM (#9421527)
> unless of course you're a masochist and ... want static typing

Some people say to prototype in a dynamically-typed language and then switch to a static language later. Dynamic typing might save keystrokes, but typecasting and type-checking do require lots of typing, and who cares that much about a few hundred extra keystrokes anyway?

Some people say to create whole, large apps in dynamically-typed languages, but those people clearly haven't tried modifying or debugging code bases in those languages that weren't created with utmost discipline and 100% test coverage.

So with 10 years of web programming experience, I'd emphatically argue that masochism is not using static typing.

I have warm, happy dreams of a future where there's a great alternative to the dynamic/weak web languages of today. There are already some great entrants, but nothing has reached the massive popularity of existing languages yet.

(Edited for clarity)

Re:Four days of Go by stock_toaster on Wednesday April 22, 2015 @01:10PM (#9421875)
I think you left off the key part of his point, namely "when recursively parsing unknown json data structures".

json parsing in Go uses reflection, which not only means it is slow, but if your input is not consistent (like say.. a log file with 20 different possible formats), it can be quite painful and very verbose.

Re:Four days of Go by wtetzner on Wednesday April 22, 2015 @04:38PM (#9423383)
If only the language had algebraic data types.
Re:Four days of Go by smt88 on Wednesday April 22, 2015 @11:40PM (#9424903)
I believe you that it's slow, but I'm not sure I know enough to understand how it's a knock against Go as a language. Is it something that's impossible to fix without changing the syntax?

Anyway, you could always use a highly-optimized JSON parser written in C[1], so it shouldn't be a deal-breaker for anyone interested in Go.

1. https://golang.org/cmd/cgo

Re:Four days of Go by jstarks on Wednesday April 22, 2015 @09:03PM (#9424465)
Do you have any resources demonstrating that JSON parsing in Go is slow?
Re:Four days of Go by stock_toaster on Wednesday April 22, 2015 @11:03PM (#9424801)
Here are a few google results:

* http://erickt.github.io/blog/2014/11/03/performance/ and http://erickt.github.io/blog/2014/11/11/benchmarks/

* https://github.com/ugorji/go-codec-bench

* https://github.com/golang/go/issues/5683

In my own testing it was faster (even with ffjson) to pre-clean my data in cpython or pypy, and then emit some intermediary format (like capnproto) for the go code to consume. I was parsing huge files full of lots of non-uniform json with many formats.

For most use cases though, the fact that json is "slow" is probably not a huge factor, as network IO or something else is likely the gating factor. For those uncommon cases though, I wish the native json lib in Go was faster.