News for hackers. Stuff that matters.
Re:The myth of using Scala as a better Java by pmarreck on Thursday March 02, 2017 @09:56AM (#13774383)
Fair enough. And to be honest I have not worked with it, and am probably biased by the conventions used in most other popular languages which do not carry over to Scala. It does seem like a disorganized kitchen-sink of ideas, though. And any time you allow mutability in any form (which would pretty much implicate any JVM language), you introduce the possibility of mutation bugs (one of the reasons I went over to functional langs to begin with... I once spent a month tracking down an irreproducible intermittent logout bug which ended up being based on a mutation bug).
Re:The myth of using Scala as a better Java by spiderjerusalem on Thursday March 02, 2017 @01:05PM (#13776508)
> And any time you allow mutability in any form ...

Odersky often says that the mutability should be as 'contained' as possible in what is otherwise a largely immutable codebase. If you can reason cleanly about a black box and are sure that the mutable variables within are not going to 'escape', you get the benefits of both

1. easier to implement, imperative algos which have been around for decades. (the alternative in pure FP is to convert stuff to tail recursion, which is not always the easiest thing to do, let's just say.)

2. easier reasoning about state not leaking to the rest of the system.

I've found following these guidelines to be very helpful.

Re:The myth of using Scala as a better Java by pmarreck on Thursday March 02, 2017 @03:00PM (#13777657)
> Odersky often says that the mutability should be as 'contained' as possible

He's 100% correct (at minimum).

> the alternative in pure FP is to convert stuff to tail recursion

It's a challenge but not THAT difficult, once you get the hang of it. :) I've found conversions fun, actually. Especially when you (of course) have to learn how to trigger TCO. The irony here of course is that at the machine language level, the recursion is converted back to imperative via TCO. But IMHO the resulting recursively functional TCO code is, eh, "more beautiful"

Re:The myth of using Scala as a better Java by the_af on Thursday March 02, 2017 @12:51PM (#13776332)
Agreed about the kitchen-sink of ideas. Also agreed about the mess of mutability and compatibility with JVM. But that's hardly something you'd notice looking at a slide in a conference :)

I also prefer cleaner languages. But, in practice, I must choose between Java and Scala, and I'd choose the latter any day, with my eyes closed!

Re:The myth of using Scala as a better Java by pmarreck on Thursday March 02, 2017 @02:45PM (#13777529)
If those are your choices, then your choice makes absolutely the most sense!