Overview
| Artifact ID: | 5fb83ff329004536dda80bb46691d6af0705263e145d810f135be62f3a3ba88e |
|---|---|
| Ticket: | b8f575aa2398b0e44b5a037326b9d75037e2da4a
Tcl 9: eof erroneously flagged with not reported encoding read error |
| User & Date: | pointsman on 2023-02-21 20:57:52 |
Changes
- icomment:
Jan, if this isn't the right place to discuss this could you kindly tell me what is the right place? You participated only sparly on the related disussions on the tcl-core mailing list. Your arguments in this ticket at 2023-02-17 08:53:35 are about why you refused to accept pooryoricks patch. As Ashok I already tried to discuss the question here on a higher level: Do you think the current trunk behaviour ([read] and [gets] not rasing error on encoding error) is better than raising error? Then I would love to read (or hear) your arguments about that. On the formal side I think current trunk is a changed script level behaviour which isn't spelled out in a TIP. At least I asked several times for the TIP descriping the new chanced [read] and [gets] behaviour without an answer and my own search in the related TIPs revealed something. So perhaps this should be made up; as TCT member your in the right position to call a vote on this. I'm not so much interested in this formal side but to find the best solution for Tcl 9. The major points why I think raising error on encoding error would be the better semantics are: - It seems to me lesser surprising, both to long-time Tclers as well as to programmers comming from other languages to Tcl (or working most of their time with other languages.) - In the vast majority of cases an encoding error on the channel will just be handled in aborting the action with notice to the user about that. It seems natural to wrap a command which may fail to do what it was told to do into a catch or try. - I agree that there are (rare) advanced cases in which one want to have the already decoded data or even somehow to recover from the encoding error (although I only have so far an only vague picture and some questions about how this should work in a sensible way). But I don't see hard technical reason which would make this impossible with [read] and [gets] raising (immediately) error. The decoded data can be returned in the error dict and the channel is still open, after the error and the channel position (what [tell] would return) could be at the same access position as in the current trunk model. - It provides the more defensively migration part. If somebody adds -strictencoding to its scripts with Tcl 9 but forget (or just not realize) to add the necessary code to its read the script will happily work without sign of error with current trunk, but produce wrong results. If the commands raise (an uncatched, in this example scenario) error the script will bail out. Which seems to be the better behaviour in my book. I stop here, leaving out a few other considerations. We should try to find consent about the [read] and [gets] semantic for Tcl 9. If we succed with that the implementation could be hammered out in much more cooperative manner.
- login: "pointsman"
- mimetype: "text/x-fossil-wiki"