• lsearch proposed option

    From Rich@21:1/5 to aotto1968@t-online.de on Thu Jan 2 21:39:32 2025
    aotto1968 <aotto1968@t-online.de> wrote:

    It is preferable to start a new thread for a new topic.

    other stuff

    # OLD

    proc ::myoo::ClassIs {myR cls} {
    upvar $myR my
    expr {[llength [lsearch -exact -sorted [set $my(__CLASS__)::__SUPER__SORTED__] $cls]] > 0}
    }

    # want to have

    proc ::myoo::ClassIs {myR cls} {
    upvar $myR my
    lsearch -exists -exact -sorted [set $my(__CLASS__)::__SUPER__SORTED__] $cls }

    ONE simple FLAG erase a lot of code.


    Write up a TIP, and supply an implementation, and the maintainers just
    might add your feature.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emiliano@21:1/5 to Rich on Thu Jan 2 20:28:54 2025
    On Thu, 2 Jan 2025 21:39:32 -0000 (UTC)
    Rich <rich@example.invalid> wrote:

    aotto1968 <aotto1968@t-online.de> wrote:

    It is preferable to start a new thread for a new topic.

    other stuff

    # OLD

    proc ::myoo::ClassIs {myR cls} {
    upvar $myR my
    expr {[llength [lsearch -exact -sorted [set $my(__CLASS__)::__SUPER__SORTED__] $cls]] > 0}
    }

    # want to have

    proc ::myoo::ClassIs {myR cls} {
    upvar $myR my
    lsearch -exists -exact -sorted [set $my(__CLASS__)::__SUPER__SORTED__] $cls
    }

    ONE simple FLAG erase a lot of code.


    Write up a TIP, and supply an implementation, and the maintainers just
    might add your feature.


    Or simply use

    proc ::myoo::ClassIs {myR cls} {
    upvar $myR my
    expr {$cls in [set $my(__CLASS__)::__SUPER__SORTED__]}
    }

    --
    Emiliano

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aotto1968@21:1/5 to Emiliano on Fri Jan 3 08:15:13 2025
    On 03.01.25 00:28, Emiliano wrote:
    On Thu, 2 Jan 2025 21:39:32 -0000 (UTC)
    Rich <rich@example.invalid> wrote:

    aotto1968 <aotto1968@t-online.de> wrote:

    It is preferable to start a new thread for a new topic.

    other stuff

    # OLD

    proc ::myoo::ClassIs {myR cls} {
    upvar $myR my
    expr {[llength [lsearch -exact -sorted [set $my(__CLASS__)::__SUPER__SORTED__] $cls]] > 0}
    }

    # want to have

    proc ::myoo::ClassIs {myR cls} {
    upvar $myR my
    lsearch -exists -exact -sorted [set $my(__CLASS__)::__SUPER__SORTED__] $cls
    }

    ONE simple FLAG erase a lot of code.


    Write up a TIP, and supply an implementation, and the maintainers just
    might add your feature.


    Or simply use

    proc ::myoo::ClassIs {myR cls} {
    upvar $myR my
    expr {$cls in [set $my(__CLASS__)::__SUPER__SORTED__]}
    }

    you just missing the "-sorted".

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)