Am 18.01.21 um 22:42 schrieb Alexandru:
> Christian Gollwitzer schrieb am Montag, 18. Januar 2021 um 22:34:33 UTC+1:
>> Am 18.01.21 um 22:15 schrieb Alexandru:
>>> Rich schrieb am Montag, 18. Januar 2021 um 22:09:40 UTC+1:
>>>> So, when one looks at the lsort man page, under dictionary one finds:
>>>>
>>>> -dictionary
>>>> Use dictionary-style comparison. This is the same as
>>>> -ascii except (a) case is ignored except as a tie-breaker
>>>>
>>>> So the -dictionary option already implies -nocase. So using -nocase
>>>> woulld "have no effect" because -dictionary is already ignoring case.
>>>
>>> I get it: In a very complicated, prgramatic way, the manual does not states, what the reader thinks it states, exept that it does...
>>> No, seariously, I urge the author of this part of the manual, to rephrase that sentence, or extend it so that normal people can correctly interpret it.
>> It's been pointed out many times before that the Tcl manual is quite
>> bad. The problem is that it is much harder to find people who enjoy
>> writing technical documentation than developers, and those are very
>> scarce for Tcl anway.
>> So, if you have a concrete proposal how to rewrite the manual, I guess
>> the TCT would happily incorporate it.
>>
>> Christian
>
> I'm also not part of the needed kind of pople, but in this case I think the logic is simple:
>
> lsearch -dictionary -nocase [list "integer" "real" "string"] "REAL"
> returns 1
>
> lsearch -dictionary [list "integer" "real" "string"] "REAL"
> return -1
>
> Hence, the -nocase option has an effect on the result of "lsearch -dictionary".
This is not quite correct. In the first lsearch invocation above, the
-dictionary option is ignored because it is only significant in the
presence of -sorted. Hence this lsearch invocation is equivalent to
lsearch -nocase [list "integer" "real" "string"] "REAL"
which returns 1, as expected. If you make the -dictionary option
significant by adding -sorted then you will see that -nocase has no
effect indeed: all the 3 lines below return -1:
lsearch -dictionary -sorted [list "integer" "real" "string"] "REAL"
lsearch -dictionary -sorted -nocase [list "integer" "real" "string"] "REAL"
lsearch -nocase -dictionary -sorted [list "integer" "real" "string"] "REAL"
> Hence, simply remove the "-dictionary" from the list of options and you get:
>
> "Causes comparisons to be handled in a case-insensitive manner. Has no effect if combined with the -integer or -real options."
In the light of the above this would not be the proper improvement in
the manual. A better version could read:
"-nocase
Causes comparisons to be handled in a case-insensitive manner.
Has no effect if combined with -dictionary (only in the presence of
-sorted), -integer, or -real."
>
> I will not write a TIP for this and I just hope, that somebody from the TCT will read this and just do it.
>
--
Csaba Nemethi
https://www.nemethi.de mailto:
csaba....@t-online.de