|
From: Poor Y. <org...@po...> - 2023-02-02 11:39:30
|
On 2023-02-02 04:19, Peter Da Silva wrote:
>> Here's another possibility for passing encoding options: Make the
>> value of
>> "-encoding" a list:
>>
>> chan configure $chan -encoding {utf-8 strict ...}
>>
>> To change options without changing the encoding:
>>
>> chan configure $chan -encoding {{} strict ...}
>
> Why not [chan configure $chan -encoding {strict ...}] and treat the
> actual encoding as just another option? There shouldn't be any
> possibility of a collision.
What about an encoding named "strict"? I'm not in favor of constraining
the
possible encoding names. According to Jan, a side-effect of TIP 601
means that
an encoding name ending in "-" is now not allowed:
https://core.tcl-lang.org/tcl/tktview/a31caff05780aabdd20a8468673340435862dbf9
I hope that, too, can be remedied.
The value of "-encoding" could be a dictionary:
chan configure $chan -encoding {name utf-8 strict 1 surrogates 0 ...}
If the number of items in the list is odd, "name" could be implied:
chan configure $chan -encoding {utf-8 strict 1 surrogates 0 ...}
chan configure $chan -encoding utf-8
The rule for conflicting option arguments could be that later arguments
take
precedence.
--
Yorick
|