Hacker News new | ask | show | jobs
by Cyph0n 3323 days ago
Why are Scala's "=" function definitions questionable? It makes absolute sense since a function should return a value.
2 comments

For the same reason omitting braces in C-style-syntax conditionals and loops is questionable, i.e. misleading indentation.

As a bit of an unreformed code golfer and a fan of ML-style syntax, I actually kinda like it myself; I was just listing a few things that are "considered questionable" (by some people) and present in both languages.

They might be referring to the update methods:

  val array = new Array[String](10)
  array.update(7, "hello")
  array(7) = "hello" // simply calls out to update
I still fail to see what makes this questionable. It's just syntactic sugar that you don't even need to use, and which is pretty clear when you see it in the wild.
Oh yeah I don't think it's questionable at all, just guessing what they're talking about.