Scala pros and cons from F# dev view

Recently I started to learn Scala (for about 2 weeks now). Here is prons and cons so far (note: I've not written any serious code yet, just have read "Scala for the impatient" and now reading "Programming in Scala" by Odersky):

Prons

  • Passing not evaluated block as argument ("by-name arguments". Allows to develop better DSLs)
  • Macros!
  • There are few libraries written with macros, impossible to implement in a language like c# or f# (MacWire etc.)

Cons

  • No not-nullable types (this is a huge one)
  • Not whitespace sensitive (curly braces everywhere) 
  • No type inference for arguments and, sometimes, for result type (signatures involving generic types may be really hairy) 
  • No compiler warning on implicitly discarded expression value (possibly wrong code like arr.map(x => x * 2); arr.map(x => x * 3). The result of the first map is discarded silently. In contrast, F# forces us to write arr |> Array.map (fun x -> x * 2) |> ignore; arr |> Array.map (fun x -> x * 3).

Comments

Hi nice reading your blog

Popular posts from this blog

Haskell: performance

Regular expressions: Rust vs F# vs Scala

Hash maps: Rust, F#, D, Go, Scala