Overview
| Artifact ID: | d325bba69c4e8ec4d8d9eda0b48965eab893331789c9aa1155711c88684432d0 |
|---|---|
| Ticket: | 8cae59ecb03a6269468379a1e028c01f604ce5de
Eliminate "-encoding binary" in favour of "-translation binary" |
| User & Date: | apnadkarni on 2024-06-20 10:03:35 |
Changes
- icomment:
I agree that current situation is confusing, and like Harald, have no clear opinion, just some thoughts. If we were starting from scratch, I would have liked to stick to the principle that setting one option should never silently change another option as -translation does today. If you want the low level options (eof, encoding, translation) that are required for binary mode, set them via fconfigure yourself, or use the simple "open b" method. However, changing -translation to not modify eof and encoding settings would now be too disruptive, so that's not an option. That leaves the question of what to do about -encoding binary. Leaving it in the current state means - `fconfigure $chan -encoding` returns a different value (iso8859-1) from what was set (binary). This gives me a bit of discomfort. - This is a (small) incompatibility with Tcl 8. If changed as Jan suggests, - It is consistent in that there is really no encoding called "binary" and there is no question of fconfigure returning a different value than was set. - This is also incompatible with Tcl 8, though in a different, probably more common and therefore serious, manner than above. A third option, not necessarily one I favor, but throwing it out there, is to make `-encoding binary` a synonym for `-translation binary` so it would also change eof and line-ending settings. - This in theory is the most incompatible with 8.6 but could actually most compatible in practice. Code that is using it will likely be also changing eof and line-endings and if not, should have been doing so and is probably broken code that would be fixed. The second option (Jan's) seems cleanest but my gut feel is that the first and third options will cause the fewest compatibility problems. With the second option, correct code "fconfigure $chan -encoding binary -translation lf -eofchar {}" will now fail. So...mixed feelings and not very helpful comments! If I were really pushed, I would keep things as they are (with a release note) but only because at this particular moment I lean towards compatibility over cleanliness :-) - login: "apnadkarni"
- mimetype: "text/x-markdown"