Is dispatch! an OK alternative to alt + cut_err? #338
-
Winnow tutorial chapter 6 suggests using But isn't this also the use-case for If so, maybe the chapter 6 tutorial should suggest this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
In that exact case, yes, I would be interested in better understanding your thought process that led to this to better understand how much of a problem it is. I'm liking keeping the examples building on each other and I dislike having a lot of side notes for exception cases, so I'd lean towards keeping it as-is but someting led you to creating this. |
Beta Was this translation helpful? Give feedback.
-
It's definitely not a problem, and once I properly understood cut_err it became clear to me that these two should be equivalent. I was mostly filing this to get your feedback on whether I should add a little note in that doc saying "in this specific case, you could use dispatch! to achieve the same effect, because dispatch will not try other branches". (I guess I like when docs link back to other related concepts but maybe you'd like to avoid little notes like that in order to keep the page tightly-focused on just cut_err) |
Beta Was this translation helpful? Give feedback.
In that exact case, yes,
dispatch
will get the job done and this is covered in an earlier chapter. The point here is more to illustrate the concept ofcut_err
. There are times when you can't convert aalt
+cut_err
into adispatch
.I would be interested in better understanding your thought process that led to this to better understand how much of a problem it is. I'm liking keeping the examples building on each other and I dislike having a lot of side notes for exception cases, so I'd lean towards keeping it as-is but someting led you to creating this.