Gauche icon indicating copy to clipboard operation
Gauche copied to clipboard

Fundamental fix of peek/read interference

Open shirok opened this issue 8 years ago • 2 comments

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

shirok avatar Mar 20 '16 00:03 shirok

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.)

shkmr avatar Mar 20 '16 01:03 shkmr

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.

shirok avatar Mar 20 '16 02:03 shirok