6 ms·
Scala inherits essentially all its expression syntax from Java, including the string +. This was done because a lot of other things in Scala are new, so we did
by modersky 13y ago
Scala inherits essentially all its expression syntax from Java, including the string +. This was done because a lot of other things in Scala are new, so we did not want to rock the boat too much with changes that might seem arbitrary. That said, I believe string + is probably the most criticized feature in Scala's expression syntax. People are generally moving away from it, towards String interpolation, which is available from Scala 2.10.
- noahmarc 13y agoThanks for joining the discussion. Just want to say I'm working through the the videos for your coursera course (https://www.coursera.org/course/progfun https://www.coursera.org/course/progfun) and, in addition to being a great introduction to Scala, it's changing how I approach other functional languages like JavaScript and R
- mercurial 13y agoAt most JavaScript is an imperative language with functional flavour
- klibertp 13y agoTry LiveScript: http://livescript.net/ http://livescript.net/ JS semantics are those of a functional-oop language. It lacks a few standard functions (LiveScript has prelude-ls) and a ton of syntactic support for things. Once these are in place, you can write the code which looks and feels like Ocaml. For example, moment.js function is `moment(dateString, formatString)`. In LiveScript I used it as: parseDate = (flip moment) "DD/MM/YYYY" Now tell me that this doesn't look like functional code :) (The only really lacking feature in JS is of course TCO, but then Clojure, so yeah, let's just trampoline everything.)
- agentultra 13y agoFair enough. Thanks for the answer. :)
- eklavya 13y agoMr. Odersky can you please take a compiler course based on Scala as well, pretty please? :P