Liste des Groupes | Revenir à cl tcl |
On 7/14/24 21:01, Harald Oehlmann wrote:I just ran the test suite and the result is quite fatal, sorry...Am 14.07.2024 um 20:25 schrieb greg:Looks almost good, except that the tests for mixin and typeofIn 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.
...
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
Les messages affichés proviennent d'usenet.