News for hackers. Stuff that matters.
Re:Advanced programming languages (2009) by premium-concern on Sunday June 19, 2016 @12:37PM (#11933532)
I can recommend Scala:

- It is mature and rock-solid, but still manages to evolve, fix issues and simplify/remove features. Most other languages are purely additive, meaning you will have to carry on all the baggage since the languages' inception.

- It is a language which is interested in identifying the best way to solve common programming issues and spares you with all this ideological "OOP/FP is bad" bullshit.

- It has the largest ecosystem (plus it can use all of Java's, too).

- It has the best tooling.

- It has the largest community.

- It has some great learning resources, like the three (or four?) Coursera courses starting in a few weeks.

- Its JavaScript backend is stable and production-ready, Scala-Native is being worked on.

> That said, I come from a C++ and Python background, so do I need to know Java well before learning Scala?

Java knowledge might reduce the amount of learning (as many Java things like the JVM also apply to Scala), but isn't really necessary. You will be fine.

Re:Advanced programming languages (2009) by gaius on Sunday June 19, 2016 @02:16PM (#11933938)
Once you have had real Hindley-Milner Scala feels painfully primitive. Just go straight to OCaml.
Re:Advanced programming languages (2009) by mafribe on Sunday June 19, 2016 @02:41PM (#11934041)
I'm afraid I disagree. I went from Ocaml to Scala. While full type inference is nice, it's a minor issue in practise, but the vastly bigger library ecosystem that Scala has (due to being a JVM language) isn't. Object orientation also works better in Scala than Ocaml.
Re:Advanced programming languages (2009) by saosebastiao on Sunday June 19, 2016 @03:39PM (#11934340)
I'm afraid you have it backwards. Scala's type inference comes at a slight cost (you have to annotate parameters), but it enables a much more powerful type system than even HM allows for.
Re:Advanced programming languages (2009) by dgudkov on Sunday June 19, 2016 @08:29PM (#11935447)
Or go to F# and enjoy the vast universe of .NET.
Re:Advanced programming languages (2009) by gaius on Monday June 20, 2016 @12:16AM (#11936026)
To be fair Scala does have access to the Java ecosystem
Re:Advanced programming languages (2009) by dsacco on Sunday June 19, 2016 @02:41PM (#11934042)
Can you expand on this for someone who is not familiar with Hindley-Milner typing?
Re:Advanced programming languages (2009) by premium-concern on Sunday June 19, 2016 @05:21PM (#11934733)
Hindley-Milner means that you – unlike Scala – don't need to provide any type annotations at all as they can all be inferred.

This comes at a steep price, as HM-inferable typesystems are very limited, and most languages have in fact a typesystem that might be based on what HM can infer, but have extensions that require type annotations.

In the end Scala's requirement to annotate input parameters is not a big deal, as this only enforces what Haskell/Ocaml/... consider to be best practice anyway.

Re:Advanced programming languages (2009) by tome on Sunday June 19, 2016 @06:42PM (#11935071)
> In the end Scala's requirement to annotate input parameters is not a big deal, as this only enforces what Haskell/Ocaml/... consider to be best practice anyway.

It's a huge deal. I always write type signatures once I know what they are, but a lot of the time I get the compiler to infer them for me which saves significant headaches.

Re:Advanced programming languages (2009) by StreamBright on Sunday June 19, 2016 @01:03PM (#11933643)
I am not sure about tooling. Do you consider SBT part of tooling? In that case I do not understand how can you say best. SBT is good enough at its finest.
Re:Advanced programming languages (2009) by premium-concern on Sunday June 19, 2016 @01:30PM (#11933757)
IDEs, editors, SBT, ScalaFmt, Mima, WartRemover, etc.

Yeah, build tools are usually terrible. Being "good enough" is enough for SBT to beat the other ones though.

(Best incremental compilation, fast artifact resolution, reliable dependency management, versioning support, fastest to-Android compilation, broadest plugin support, interactive REPL and project console ...)

Re:Advanced programming languages (2009) by shrugger on Sunday June 19, 2016 @01:02PM (#11933641)
I am so freaking excited about Scala Native. I haven't been so genuinely excited and enthusiastic about something for such a long time, but Scala Native is so awesome.

I feel like turning Scala into a cross-platform language is the best idea possible. I'd love to see Scala someday be able to just dump out WebAssembly, or JVM bytecode, or LLVM IR, or whatever the next "hip" format is, while keeping the language the same.

I also find it shocking how hard people are pushing Typescript when Scala.js exists. Why would you ever subject yourself to TS?!?!

Re:Advanced programming languages (2009) by kmiroslav on Sunday June 19, 2016 @01:58PM (#11933852)
The size of the Javascript generated by Scala.js alone makes it a non starter for serious projects.
Re:Advanced programming languages (2009) by premium-concern on Sunday June 19, 2016 @04:41PM (#11934583)
Yeah, these tens of kilobytes of JS next to those ten badly compressed 600kB jpgs are really killing it.
Re:Advanced programming languages (2009) by dastbe on Sunday June 19, 2016 @06:46PM (#11935087)
this isn't a fair comparison. It fails to account for what happens after the files are downloaded, which is where overall js code size has an outsized effect.
Re:Advanced programming languages (2009) by premium-concern on Monday June 20, 2016 @07:15AM (#11937272)
I think people have been including jQuery just fine for the last decade.
Re:Advanced programming languages (2009) by dastbe on Monday June 20, 2016 @11:40AM (#11938705)
Yes, but jquery is much smaller than an empty scala.js app. jquery is about 25kb gzipped and minified (the other comment used the raw size) whereas scala js is 45kb for an empty application.
Re:Advanced programming languages (2009) by raquo on Monday June 20, 2016 @04:04PM (#11941023)
TBH, You don't use scala.js to write hello world apps. I'm much more curious how Scala.js handles a 100Kloc app, but I haven't seen any data on that.
Re:Advanced programming languages (2009) by idobai on Sunday June 19, 2016 @02:11PM (#11933916)
Look at here: https://www.scala-js.org/

"The generated JavaScript is both fast and small, starting from 45kB gzipped for a full application." - 45kB... jQuery is ~80kB.

Re:Advanced programming languages (2009) by dastbe on Tuesday June 21, 2016 @11:11AM (#11946199)
jQuery gzipped and minified is 25kb. You're comparing raw to compressed.
Re:Advanced programming languages (2009) by watchxxx on Sunday June 19, 2016 @08:52PM (#11935513)
Cedric, how does a 45KB js file make Scala a non-starter?
Re:Advanced programming languages (2009) by bogomipz on Sunday June 19, 2016 @02:22PM (#11933960)
What is Scala native? Is there a Scala that doesn't rely on the JVM for hosting?
Re:Advanced programming languages (2009) by neverminder on Sunday June 19, 2016 @04:13PM (#11934465)