Gauche
Gauche copied to clipboard
Fundamental fix of peek/read interference
Scm_Peekc currently ignores scratch buffer. GETC_SCRATCH still has issues with keeping remaining octets in scratch buffer.
Related: https://github.com/shirok/Gauche/pull/186
In your comment in #186, you suggest putting spectial mark on char object when invalid byte sequence is encountered.
Would it be possible just raising an error in that case? (possibly with an API to get the bytes in question.)
That could be one solution. Invalid byte sequences could throw an error in CES conversion routine anyway, so wrapping invalid octet as a special kind of char is at most an unreliable abstraction (meaning, you can't count on it everywhere). My concern is that occasionally you do encounter unexpected data, and sometimes throwing an error is inconvenient. But probably a flaky abstraction won't do much good.