Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Harald Oehlmann Newsgroups: comp.lang.tcl Subject: Re: Tklib's tooltip poss bug in method although fine in a function Date: Mon, 15 Jul 2024 09:25:45 +0200 Organization: A noiseless patient Spider Lines: 72 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 15 Jul 2024 09:25:46 +0200 (CEST) Injection-Info: dont-email.me; posting-host="6bc6ed01fd37c7a470c785032106fc93"; logging-data="629996"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/CmebjLFe5WpInNyvdta/9" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:nRpHItiOOjCxEaVR22DYz3GyQyg= In-Reply-To: Content-Language: en-GB Bytes: 3783 Am 15.07.2024 um 06:22 schrieb undroidwish: > On 7/14/24 21:01, Harald Oehlmann wrote: >> Am 14.07.2024 um 20:25 schrieb greg: >>> In msgcat.tcl (Tcl 9.0) >>> >>> This means I no longer get the error message. >>> The namespace is being searched for at this point, and in my opinion >>> self is not needed at all. >>> >>> >>> proc ::msgcat::PackageNamespaceGet {} { >>>      set ns [uplevel 2 { namespace current }] >>> >>>      if {![string match {::oo::*} $ns]} { >>>          # Not in object environment >>>          return $ns >>>      } >>> >>>      # Check if we are within an object >>>      if {[info object isa object $ns]} { >>>          return [info object namespace $ns] >>>      } elseif {[info object isa class $ns]} { >>>          return [info object namespace $ns] >>>      } elseif {[info object isa metaclass $ns]} { >>>          return [info object namespace $ns] >>>      } elseif {[info object isa mixin $ns]} { >>>          return [info object namespace $ns] >>>      } elseif {[info object isa typeof $ns]} { >>>          return [info object namespace $ns] >>>      } else { >>>          # Not in an object or class environment >>>          return $ns >>>      } >>> } >>> >>> Gregor >>> >> >> Thanks a lot, Gregor. >> >> Your proposed solution is now in a branch referenced in the ticket. >> It would be great, if: >> - there would be a test case for the issue >> - the comment above the modification may be corrected. If I count the >> "if's" I get 7 cases and not 4. >> ... > > Looks almost good, except that the tests for mixin and typeof > require more context (one additional parameter). Thus they must > be left out, i.e. > >       ... >       # Check if we are within an object >       if {[info object isa object $ns]} { >           return [info object namespace $ns] >       } elseif {[info object isa class $ns]} { >           return [info object namespace $ns] >       } elseif {[info object isa metaclass $ns]} { >           return [info object namespace $ns] >       } >       # Not in an object or class environment >       return $ns >      ... > > My 0.02 currency units, > Christian I just ran the test suite and the result is quite fatal, sorry... https://core.tcl-lang.org/tcl/tktview/91b3a5bb14e6e8ae1d1c5349af12e08879ea152d Thanks for all, Harald