Closed dinosaure closed 5 years ago
I'm not sure how useful this function is. It'll help avoid the specific case you've mentioned, but parsing necessarily requires the user to write a loop. This saves you one iteration of the loop but then you have to still write and enter the loop.
Put another way, where is that first bigstring coming from? If there's more input that's needed, will it come from the same place? I think the answer to that is probably yes. If there's a common situation where the sources are different though, I'd be interested in learning about it.
You can see an example here where I want to provide a non-blocking interface to parse header of e-mail with angstrom
. The code is little bit un-readable at this point however.
And, in other side, I have a serious question. Why you did not come to Marrakesh 😥 ?
I think that this function wouldn't be necessary if you turned decode
into a recursive function, started a new parse in the Done
case, called decode
recursively after doing that, and fed input in the partial case only. That also (to me) makes more sense since you feed input under the case where the parser tells you it need more input.
Closing for now, assuming no further discussion is necessary.
Thanks for your review on mrmime
:+1:
This code function is to able to replace this kind of bad code: