Result and PartialResult errors include a string describing the nature of the failure. Sometimes these strings are constants, but in other cases these strings are generated and therefore require allocation.
A compounding problem is that errors are often not read. Or, an inner-most error message might be discarded by failures in later parsers.
To avoid allocating custom strings which are not read or used, I suggest some kind of a lazy mechanism for generating strings only at the time they are used, such as a delegate callback wrapped in some kind of object with valuetuple parameters. It would be a little bit more expensive to read the string, but we hope that most of these strings are not being read.
Result and PartialResult errors include a string describing the nature of the failure. Sometimes these strings are constants, but in other cases these strings are generated and therefore require allocation.
A compounding problem is that errors are often not read. Or, an inner-most error message might be discarded by failures in later parsers.
To avoid allocating custom strings which are not read or used, I suggest some kind of a lazy mechanism for generating strings only at the time they are used, such as a delegate callback wrapped in some kind of object with valuetuple parameters. It would be a little bit more expensive to read the string, but we hope that most of these strings are not being read.