Index: generic/predefined.h =================================================================== diff -u -re5b7b9261b0de87bf7a45ff7416ecd967037fa0b -rf279bf06b31139084edd5136824a1e2622265e00 --- generic/predefined.h (.../predefined.h) (revision e5b7b9261b0de87bf7a45ff7416ecd967037fa0b) +++ generic/predefined.h (.../predefined.h) (revision f279bf06b31139084edd5136824a1e2622265e00) @@ -288,9 +288,9 @@ "if {![set .multivalued]} {\n" "error \"Property $prop of ${.domain}->$obj ist not multivalued\"}\n" "set oldSetting [::xotcl::relation $obj $prop]\n" -"::xotcl::relation $obj $prop [linsert $oldSetting $pos $value]}\n" +"uplevel [list ::xotcl::relation $obj $prop [linsert $oldSetting $pos $value]]}\n" "::xotcl::InterceptorSlot public method delete {-nocomplain:switch obj prop value} {\n" -"::xotcl::relation $obj $prop [.delete_value $obj $prop [::xotcl::relation $obj $prop] $value]}\n" +"uplevel [list ::xotcl::relation $obj $prop [.delete_value $obj $prop [::xotcl::relation $obj $prop] $value]]}\n" "proc ::xotcl::register_system_slots {os} {\n" "${os}::Object alloc ${os}::Class::slot\n" "${os}::Object alloc ${os}::Object::slot\n" Index: generic/predefined.xotcl =================================================================== diff -u -re5b7b9261b0de87bf7a45ff7416ecd967037fa0b -rf279bf06b31139084edd5136824a1e2622265e00 --- generic/predefined.xotcl (.../predefined.xotcl) (revision e5b7b9261b0de87bf7a45ff7416ecd967037fa0b) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision f279bf06b31139084edd5136824a1e2622265e00) @@ -556,10 +556,11 @@ error "Property $prop of ${.domain}->$obj ist not multivalued" } set oldSetting [::xotcl::relation $obj $prop] - ::xotcl::relation $obj $prop [linsert $oldSetting $pos $value] + # use uplevel to avoid namespace surprises + uplevel [list ::xotcl::relation $obj $prop [linsert $oldSetting $pos $value]] } ::xotcl::InterceptorSlot public method delete {-nocomplain:switch obj prop value} { - ::xotcl::relation $obj $prop [.delete_value $obj $prop [::xotcl::relation $obj $prop] $value] + uplevel [list ::xotcl::relation $obj $prop [.delete_value $obj $prop [::xotcl::relation $obj $prop] $value]] } ############################################ Index: generic/xotcl.c =================================================================== diff -u -rb86763d637c7f92cb328215133236de0ca67c679 -rf279bf06b31139084edd5136824a1e2622265e00 --- generic/xotcl.c (.../xotcl.c) (revision b86763d637c7f92cb328215133236de0ca67c679) +++ generic/xotcl.c (.../xotcl.c) (revision f279bf06b31139084edd5136824a1e2622265e00) @@ -1032,7 +1032,7 @@ /*fprintf(stderr, "NameInNamespaceObj %s (%p, %s) ", name, nsPtr, nsPtr?nsPtr->fullName:NULL);*/ if (!nsPtr) nsPtr = Tcl_GetCurrentNamespace(interp); - /*fprintf(stderr, " (resolved %p, %s) ", nsPtr, nsPtr?nsPtr->fullName:NULL);*/ + /* fprintf(stderr, " (resolved %p, %s) ", nsPtr, nsPtr?nsPtr->fullName:NULL);*/ objName = Tcl_NewStringObj(nsPtr->fullName,-1); len = Tcl_GetCharLength(objName); p = ObjStr(objName); @@ -3595,7 +3595,7 @@ rc = addToResultSet(interp, destTable, &cl->object, &new, appendResult, pattern, matchObject); if (rc == 1) {return rc;} if (new) { - fprintf(stderr, "... new\n"); + /*fprintf(stderr, "... new\n");*/ rc = getAllClassMixinsOf(interp, destTable, cl, 1, appendResult, pattern, matchObject); if (rc) {return rc;} } @@ -9238,9 +9238,6 @@ Tcl_CallFrame *framePtr; Tcl_Namespace *nsPtr; - /* fprintf(stderr, "nonXotclObjectProcFrame returned %p frame %p, currentNs %p %s, xot %p %s\n", - framePtr, Tcl_CallFrame_callerPtr(csc->currentFramePtr), nsPtr, nsPtr?nsPtr->fullName:NULL, - RUNTIME_STATE(interp)->XOTclNS, RUNTIME_STATE(interp)->XOTclNS->fullName); */ /*tcl85showStack(interp);*/ /* Index: generic/xotclStack85.c =================================================================== diff -u -re61fc14f5c25172a1d1f93bea03be54a772fb4b5 -rf279bf06b31139084edd5136824a1e2622265e00 --- generic/xotclStack85.c (.../xotclStack85.c) (revision e61fc14f5c25172a1d1f93bea03be54a772fb4b5) +++ generic/xotclStack85.c (.../xotclStack85.c) (revision f279bf06b31139084edd5136824a1e2622265e00) @@ -47,9 +47,11 @@ nonXotclObjectProcFrame(Tcl_CallFrame *framePtr) { for (; framePtr; framePtr = Tcl_CallFrame_callerPtr(framePtr)) { register int flag = Tcl_CallFrame_isProcCallFrame(framePtr); + if (flag & FRAME_IS_XOTCL_METHOD) { /* never return an inactive method frame */ - if (!(((XOTclCallStackContent *)Tcl_CallFrame_clientData(framePtr))->frameType & XOTCL_CSC_TYPE_INACTIVE)) break; + if (!(((XOTclCallStackContent *)Tcl_CallFrame_clientData(framePtr))->frameType + & XOTCL_CSC_TYPE_INACTIVE)) break; } else { if (flag & FRAME_IS_XOTCL_OBJECT) continue; /*if ((flag & (FRAME_IS_XOTCL_OBJECT|FRAME_IS_XOTCL_CMETHOD)) == 0) break;*/ Index: library/lib/test.xotcl =================================================================== diff -u -r73eb4eccd33d1a940e2d2ca6dccc2f74216f0576 -rf279bf06b31139084edd5136824a1e2622265e00 --- library/lib/test.xotcl (.../test.xotcl) (revision 73eb4eccd33d1a940e2d2ca6dccc2f74216f0576) +++ library/lib/test.xotcl (.../test.xotcl) (revision f279bf06b31139084edd5136824a1e2622265e00) @@ -68,7 +68,7 @@ .public method call {msg cmd} { if {[.verbose]} {puts stderr "$msg: $cmd"} - namespace eval [set .namespace] $cmd + namespace eval ${.namespace} $cmd } .public method run args { @@ -84,7 +84,7 @@ if {$c > 1} { #set r0 [time ${.cmd} $c] #puts stderr "time {time ${.cmd} $c}" - set r1 [time {time {namespace eval [set .namespace] ${.cmd}} $c}] + set r1 [time {time {namespace eval ${.namespace} ${.cmd}} $c}] #regexp {^(-?[0-9]+) +} $r0 _ mS0 regexp {^(-?[0-9]+) +} $r1 _ mS1 set ms [expr {$mS1*1.0/$c}] @@ -106,10 +106,12 @@ } proc ? {cmd expected {msg ""}} { + set namespace [uplevel {namespace current}] + #puts stderr "eval in namespace $namespace" if {$msg ne ""} { - set t [Test new -cmd $cmd -msg $msg] + set t [Test new -cmd $cmd -msg $msg -namespace $namespace] } else { - set t [Test new -cmd $cmd] + set t [Test new -cmd $cmd -namespace $namespace] } $t expected $expected $t run Index: tests/destroytest.xotcl =================================================================== diff -u -r73eb4eccd33d1a940e2d2ca6dccc2f74216f0576 -rf279bf06b31139084edd5136824a1e2622265e00 --- tests/destroytest.xotcl (.../destroytest.xotcl) (revision 73eb4eccd33d1a940e2d2ca6dccc2f74216f0576) +++ tests/destroytest.xotcl (.../destroytest.xotcl) (revision f279bf06b31139084edd5136824a1e2622265e00) @@ -227,13 +227,13 @@ test::C create test::c1 test::c1 foo puts stderr ======[::xotcl::is test::c1 object] -? {::xotcl::is test::c1 object} 0 "$::case object still exists after proc" +? {::xotcl::is test::c1 object} 0 "object still exists after proc" ? "set ::firstDestroy" 1 "firstDestroy called" ? "set ::ObjectDestroy" 1 "destroy was called when poping stack frame" -? {::xotcl::is ::test::C object} 0 "$::case class still exists after proc" -? {namespace exists ::test::C} 0 "$::case namespace ::test::C still exists after proc" -? {namespace exists ::test} 0 "$::case parent ::test namespace still exists after proc" -? {namespace exists ::xotcl::classes::test::C} 0 "$::case namespace ::xotcl::classes::test::C still exists after proc" +? {::xotcl::is ::test::C object} 0 "class still exists after proc" +? {namespace exists ::test::C} 0 "namespace ::test::C still exists after proc" +? {namespace exists ::test} 1 "parent ::test namespace still exists after proc" +? {namespace exists ::xotcl::classes::test::C} 0 "namespace ::xotcl::classes::test::C still exists after proc" # # namespace delete: tcl delays delete until the namespace is not Index: tests/varresolutiontest.xotcl =================================================================== diff -u -r7970a3bf8beef94aa92d0faf58d5ab183e19658d -rf279bf06b31139084edd5136824a1e2622265e00 --- tests/varresolutiontest.xotcl (.../varresolutiontest.xotcl) (revision 7970a3bf8beef94aa92d0faf58d5ab183e19658d) +++ tests/varresolutiontest.xotcl (.../varresolutiontest.xotcl) (revision f279bf06b31139084edd5136824a1e2622265e00) @@ -494,3 +494,20 @@ ? {set ::C} 1 ? {f1 eval {set .c}} 4 + + +################################################## +# test for namespace resolver +################################################## +Test case nsresolver +namespace eval module { + Class create C + Class create M1 + Class create M2 + + C mixin M1 + ? {::xotcl::relation C class-mixin} "::module::M1" + puts stderr "mixin add M" + C mixin add M2 + ? {::xotcl::relation C class-mixin} "::module::M2 ::module::M1" +} \ No newline at end of file