Another thing it gains is that it discourages people from thinking they can use exceptions in dtors; having these laundered through MatchException discourages using this as a side channel, though that's a more minor thing.This is a stronger argument than you give it credit for being. Wrapping the exception adds a bit of friction to doing the wrong thing which will pay off in helping guide users to the intended behaviour.
Yes, and this is a special case of a more general thing -- that while
pattern declarations may have a lot in common with methods, they are not
"just methods with multiple return" (e.g., they have a different set of
characteristics at the declaration, they are intrinsically conditional,
they are "invoked" differently.) While their bodies may look
method-like, and ultimately they boil down to methods, thinking "they
are just methods" is likely to drag you to the wrong place. Of course,
its a balance between how similar and HOW DIFFERENT they are, and that's
what we're looking for.
- Re: Remainder in pattern matching Remi Forax
- Re: Remainder in pattern matching Dan Heidinga
- Re: [External] : Re: Remainder in pattern matching Brian Goetz
- Re: [External] : Re: Remainder in pattern matching Brian Goetz
- Re: [External] : Re: Remainder in pattern matching Dan Heidinga
- Re: [External] : Re: Remainder in pattern matchi... Brian Goetz
- Re: [External] : Re: Remainder in pattern matchi... Remi Forax
- Re: [External] : Re: Remainder in pattern matchi... Brian Goetz
- Re: Remainder in pattern matching Alan Malloy