Think about Loose Coupling | |
PerlMonks |
Re^2: What does utf8::upgrade actually do.by syphilis (Archbishop) |
on Feb 17, 2021 at 12:34 UTC ( [id://11128492]=note: print w/replies, xml ) | Need Help?? |
What an XS module does when it wants to process a list of bytes is of course up to the XS module's author Ok - but I guess the module author (me) should probably document the procedure that the module takes. (The lack of any such documentation seems to have been a part of ribasushi's objection, and I think that's fair enough.) For simplicity, let's stick to a single-byte string: But let's say the user instead does a utf8::upgrade of the string, as per the following: The crux of the issue is "what do I (the module author) conclude regarding the expectation of the user that wrote that second block of code ? " As I see it, I have only 3 choices: a) conclude that the user's expected result is to see an output of "255"; b) conclude that the user's expected result is to see an output of "195"; c) conclude that I have insufficient information to know what output the user expects (except that the user will be expecting either "255" or "195"). Which is the correct conclusion for me to reach ? I can accommodate either 'a)', 'b)', or 'c)' and I think the answer is probably 'c)', but I'd just like an informed opinion on that. Cheers, Rob
In Section
Seekers of Perl Wisdom
|
|