News for hackers. Stuff that matters.
Re:Clojure vs. Scala by lmm on Tuesday December 24, 2013 @11:17AM (#6959909)
> It turns out, this describes expert Java programmers very well, too -- so it's no surprise that Scala is a very popular language with Java programmers. I'm finding that Clojure is the more attractive language if your sensitivities lean toward the "simplicity" and "dynamism" camp. I was reading some Scala code being used in production at Twitter and found this marvel: https://twitter.com/amontalenti/status/410977749629546496 -- you would simply never see anything like this in Clojure or Python codebases.

Well done, you found some bad code written in Scala. I can assure you I've seen far worse in Python.

Re:Clojure vs. Scala by Bahamut on Tuesday December 24, 2013 @11:20AM (#6959932)
Out of curiosity, is that piece of code necessary? Is there no better way to condense that? I'm a beginner with Scala, so I have no clue on that front.
Re:Clojure vs. Scala by lmm on Tuesday December 24, 2013 @11:28AM (#6959977)
Well, that code exists at all for compatibility with tuples, which are a misfeature from the early days of scala. The "right" way to solve the problem is with shapeless' HLists. With HList you could write a simple generic method that would work with a HList of any length. (If you don't need to join a bunch of hetrogenously-typed futures while preserving all their type distinctions then you could just use the method that takes a Seq, above in the file)

(You could also generate exactly this code with macros, which were a new feature in scala 2.10; I imagine a newer version of the code will do that)

Re:Clojure vs. Scala by smrtinsert on Tuesday December 24, 2013 @03:56PM (#6961096)
I'm surprised you can't map over tuple members and join. Should be a one liner, but I'm a scala newbie though. Tupled were an unnecessary choice here.

Pointing to this kind of stuff as an example of scala shows a complete misunderstanding of the language quite honestly.

Re:Clojure vs. Scala by saryant on Tuesday December 24, 2013 @01:10PM (#6960410)
There are some similar ugly workarounds of that nature in Play's JSON macros. Quite ugly but also transparent to anyone not writing library code.
Re:Clojure vs. Scala by CCs on Tuesday December 24, 2013 @12:07PM (#6960136)
That is a library code, not something you would write (or try to understand) normally.