Generator: Be mean to me!
chrysn opened this issue · comments
The CBOR generator shipped of the cddl
crate was relatively benign, sending values for tstr
such as "shudders", "Albion" or "Helene's".
If a generator comes out of this project, I'd like to have an option to make it mean. It might then produce values like "Baho\u0308" (with the NFD of "ö"), "\u0000 bytes", "\ufeffRuf\ufefffolge" (with both a BOM and the deprecated form of the word joiner, which inhabits the same code point, abused to prevent a ligature), "Ruf\u200dfolge" (the proper way to do it, probably), "Tinker\u0007", "Ctrl Alt \u007f", "NNN\u0083", and maybe also "\ue000" (private use; a penguin on my system), "🌊🐗" (outside BMP), "\uffff" (a noncharacter) and character at the decimal code point 129023 (which is unassigned, but I refuse to write it down in diagnostic notation to not confuse myself and others).
As that behavior is often undesired, it could be hidden behind a --be-mean
flag. (That flag might also trigger other mean behavior, such as producing integers below -2**63
, tdate hitting leap seconds, float generating denormalized numbers and NaN, and rude language).