Friday, August 15, 2014

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):


  • 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.)


  • 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 => x * 2); => x * 3). The result of the first map is discarded silently. In contrast, F# forces us to write arr |> (fun x -> x * 2) |> ignore; arr |> (fun x -> x * 3).

No comments: