News for hackers. Stuff that matters.
Re:Making the move from Scala to Go by faitswulff on Tuesday January 24, 2017 @09:50PM (#13478038)
The full comment is actually:

> No map, no flatMap, no fold, no generics, no inheritance… Do we miss them? Perhaps we did, for about two weeks.

So they weren't complaining about map and flatMap, they just missed them.

Re:Making the move from Scala to Go by nine_k on Wednesday January 25, 2017 @01:17AM (#13479130)
They only missed these features for 2 weeks?

Good for them! Their problem domain is likely so simple and neat that it fits the Go's limited built-in types well, and does not lead to frequent copy-paste programming. If so, Scala has been an overkill.

Re:Making the move from Scala to Go by unscaled on Wednesday January 25, 2017 @05:57AM (#13480371)
Lucky bunch indeed. I'm 9 months in and still missing map(), flatMap(), let alone more advanced FP. I guess this is a matter of personal preference, but I definitely consider:

  users.filter(_.active).map(_.email)
to be easier to read (and not a pain in the ass to type) than:

  emails := make([]string, 0)
  for _, u := range users {
    if u.active {
      emails = append(emails, u.email)
    }
  }
  return email
The first style is more explicit about what you want to do, the second style is more explicit about how you want to do it. Go made imperative vogue again, but for me it feels like a throwback all the way to Turbo Pascal. Sure, the Go compiler is really fast, but Turbo Pascal would beat it hands down - on 20Mhz machines with 1MB of RAM.
Re:Making the move from Scala to Go by pjmlp on Wednesday January 25, 2017 @07:32AM (#13480862)
> Sure, the Go compiler is really fast, but Turbo Pascal would beat it hands down - on 20Mhz machines with 1MB of RAM.

With more features (TP 7)!

Re:Making the move from Scala to Go by jim_d on Wednesday January 25, 2017 @11:23PM (#13488684)
completely agree. There is a certain beauty to the first version that once you've learned the concepts it seems a shame to have to write the second one.
Re:Making the move from Scala to Go by nunobrito on Wednesday January 25, 2017 @08:54AM (#13481340)
The second example is vastly more readable in terms of understanding what it is supposed to do.

I mention this as neither a programmer on either Scala nor Go.

If it is of any relevance, I've been writing code for about 20 years across C, Java, Javascript, PHP and shell scripts. I'm sure other FP developers will roll their eyes to a traditional developer like me but the one-liner you mention is simply not self-explanatory for an outsider when reading it.

Re:Making the move from Scala to Go by spdionis on Wednesday January 25, 2017 @09:16AM (#13481476)
"I've been speaking italian, french and spanish for 20 years. I'm sure people who speak germanic languages will roll their eyes to a traditional latin-languages guy like me, but the german sentence you mention is simply not self-explanatory for an outsider when reading it."
Re:Making the move from Scala to Go by kaoD on Wednesday January 25, 2017 @09:17AM (#13481487)
The second one is so readable it contains a subtle bug nobody noticed.
Re:Making the move from Scala to Go by gribbly on Wednesday January 25, 2017 @11:15AM (#13482613)
What 'subtle' bug ?

It returns 'email' instead of 'emails' which I assume was a typo, which of course the compiler would complain about, are you claiming that a variable name typo is somehow a 'subtle bug' ?

Only other thing I see directly is that 'users' is undefined, but this is a code snippet after all, not a working program.

Re:Making the move from Scala to Go by kornish on Wednesday January 25, 2017 @05:18PM (#13486778)
I think kaoD's point is that more code will always produce more errors, and more code (in the name of "readability") can give more surface area for bugs.
Re:Making the move from Scala to Go by sacheendra on Wednesday January 25, 2017 @09:42AM (#13481684)
But that would be caught by the compiler. The error would be variable not defined.
Re:Making the move from Scala to Go by matt_kantor on Thursday January 26, 2017 @12:36PM (#13493349)
Out of curiosity, what specifically do you find unreadable about the first example?
Re:Making the move from Scala to Go by kjksf on Wednesday January 25, 2017 @01:25AM (#13479171)
As simple as a distributed, horizontally scalable SQL database, perhaps? (https://github.com/cockroachdb/cockroach).

Those dumb Go programmers and their toy programs (https://quicknotes.io/n/1XB0).

Re:Making the move from Scala to Go by pjmlp on Wednesday January 25, 2017 @04:59AM (#13480126)
I program since the mid-80's, many of the features in modern languages weren't always available outside research institute walls, and yet we managed to deliver any sort of software with the tools we had at our disposal.

However, now that those features are part of the majority of mainstream languages, I surely don't want to go back to how I used to write software in the first two decades of my career.

Re:Making the move from Scala to Go by unscaled on Wednesday January 25, 2017 @06:13AM (#13480461)
Developers have been using C and a bunch of other imperative languages for years. They obviously, created software two order magnitudes more complex than CockroachDB (or Docker, or Kubernetes, or etcd). We used to write entire operating systems in assembly, heavens forbid. Just look at the PostgreSQL codebase (all C) and compare that to cockroach DB.

Being "a better C" was the original battle cry of Go. It's definitely better than C (well, at least for some thing), but it doesn't mean all of these complex C software people used to write are toys.

Go is obviously not a useless toy language either. But that doesn't mean you won't miss features from more expressive languages. The amount of calls for generics from Go users tell a different story.

Re:Making the move from Scala to Go by geodel on Wednesday January 25, 2017 @09:10AM (#13481429)
> The amount of calls for generics from Go users tell a different story

I think it is from Non-Go users who would use Go if only it had generics.

Re:Making the move from Scala to Go by unscaled on Thursday January 26, 2017 @05:23AM (#13490179)
Some of it, probably. But some are probably using Go out of necessity (your company enforces Go), or because they still think Go is their best pragmatic option, lack of generics notwithstanding.
Re:Making the move from Scala to Go by sanjayts on Wednesday January 25, 2017 @04:28PM (#13486325)
I do competitive programming using Go and sorely miss "generics" so I'm pretty sure that your thought is not entirely correct.
Re:Making the move from Scala to Go by nollbit on Wednesday January 25, 2017 @02:15AM (#13479408)
Software can be complex without having very complex types
Re:Making the move from Scala to Go by nine_k on Wednesday January 25, 2017 @03:04AM (#13479639)
The guys who wrote CockroachDB never, afaik, tried to write it in Scala, and never told us whether they miss flatMap, generics, or something like that.

They guys from Movio did; their problem domain is likely different.