You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by Luis Ángel Vicente Sánchez <la...@gmail.com> on 2014/06/20 00:13:06 UTC

Rationale behind scala enumerations instead of sealed traits and case objects

While I was trying to execute a job using spark-submit, I discover a
scala.MatchError at runtime... a DriverStateChanged.FAILED message was send
to an actor, and the match statement used was not taking that value into
account.

When I inspected that DriverStateChange.scala file I discovered that it's a
scala enumeration; if a sealed trait and case objects would have used, the
compiler would have refused to compile spark until that match statement
would have covered all possible values.

As a scala developer I prefer to catch that kind of errors at compile time
and I would like to understand why a scala enumeration has been used
instead of a sealed trait + case object. If changing that to a sealed (and
possible others) keeps binary compatibility, would that kind of PR be
welcomed?

Kind regards,

Luis