Oh, I understand what you were getting at. I still see it as somewhat obfuscatory though. I also don't really like it conceptually, as the
is actually doing the match from scratch (so it's not an atomic operation). It might still be the best way to go about this problem, I don't know: I don't remember ever having to have needed to implement such logic so I have no realistic example scenario to go by. I just can't help the feeling that there has to be a clearer way.