Jeremy,

On Mon, Jun 9, 2014 at 10:22 AM, Jeremy Lee
<unorthodox.engine...@gmail.com> wrote:
>> When you use match, the match must be exhaustive. That is, a match error
>> is thrown if the match fails.
>
> Ahh, right. That makes sense. Scala is applying its "strong typing" rules
> here instead of "no ceremony"... but isn't the idea that type errors should
> get picked up at compile time? I suppose the compiler can't tell there's not
> complete coverage, but it seems strange to throw that at runtime when it is
> literally the 'default case'.

You can use subclasses of "sealed traits" to get a compiler warning
for non-exhaustive matches:
http://stackoverflow.com/questions/11203268/what-is-a-sealed-trait
I don't know if it can be applied for regular expression matching, though...

Tobias

Reply via email to