Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Emiliano Newsgroups: comp.lang.tcl Subject: Re: lsearch proposed option Date: Thu, 2 Jan 2025 20:28:54 -0300 Organization: A noiseless patient Spider Lines: 39 Message-ID: <20250102202854.b9d16596b2f78f5f4cff2823@example.invalid> References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Fri, 03 Jan 2025 00:29:04 +0100 (CET) Injection-Info: dont-email.me; posting-host="5ee07b96d6ad73c243fa74a16a2ba82a"; logging-data="3743448"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193/FvvASFDK/WGH2hLkp/G2o1niXmrUpY=" Cancel-Lock: sha1:2dmL04dgf61C1xUXeepGe1CppTM= X-Newsreader: Sylpheed 3.5.1 (GTK+ 2.24.32; i686-pc-linux-gnu) Bytes: 1862 On Thu, 2 Jan 2025 21:39:32 -0000 (UTC) Rich wrote: > aotto1968 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