Open victorporof opened 7 years ago
I agree, but this is as good a place as any to note three observations:
unwrap
s in that parser are totally appropriate. That is, if we read an optional sign
, then any number of digit
s, followed by an N
, and it doesn't parse to a BigInt
, we are in deep shit, and we should crash hard. It means either something is in a bad state, or we have a serious coding error. panic
is an appropriate way to deal with the world being wrong.Death, alas, is a part of life.
E.g. https://github.com/mozilla/mentat/blob/ab041291fb1d806fc1e9c09ecac4a931289bd38f/edn/src/edn.rustpeg#L45 and in a few other places.
Panicking the entire thread while parsing is probably a bad idea? This would be easily recoverable and a good place to add syntax check info.