On Thu, Jul 10, 2014 at 3:28 PM, Geoffrey Irving <[email protected]> wrote:

> I agree that pattern matching is weirdly hard to implement each time
> I've done it, but if we dropped this from bitc do we have any other
> way of safely and completely (no missed cases) destructuring algebraic
> datatypes?  I also dislike pattern matching in terms of extensibility,
> so if we have something good to replace it I'm all for it.


Safe and complete destruction often isn't a goal in systems codes. For
BitC, we required that a switch on a union cover all variants. Otherwise,
we simply used named field access. That didn't give us generally safe and
complete destructuring, but I can't think of a case offhand in which that
bit us.

Note also that pattern matching on a mutable structure is a bit more
complicated than pattern-based deconstruction on a pure structure. In the
mutable case, deconstruction needs to yield *locations* rather than *values*.
Because of this, the pattern matching idiom isn't as natural in BitC as it
is in Haskell or ML.


shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to