| Ticket UUID: | 1483168 | |||
| Title: | Namspaced snit objs are not commands in their ns | |||
| Type: | Bug | Version: | None | |
| Submitter: | pointsman | Created on: | 2006-05-07 00:17:09 | |
| Subsystem: | snit | Assigned To: | duquette | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2006-08-19 23:52:00 | |
| Resolution: | Fixed | Closed By: | duquette | |
| Closed on: | 2006-08-19 16:52:00 | |||
| Description: |
package require snit
namespace eval ns { }
proc ns::someProc {msg} {
puts "From $msg"
}
proc ns::anotherProc {} {
someProc "ns::anotherProc"
}
snit::type ::ns::myObj {
constructor {args} {
someProc "::ns::myObj"
}
}
ns::anotherProc
ns::myObj foo
| |||
| User Comments: |
duquette added on 2006-08-19 23:52:00:
Logged In: YES user_id=372859 This has been fixed in Snit 2.0 using [namespace path]. dgp added on 2006-08-09 22:25:16: Logged In: YES user_id=80530 [namespace path] is available in Tcl 8.5a3 and later. duquette added on 2006-08-09 07:12:58: Logged In: YES user_id=372859 This is because the type *is* a namespace. In your example, the ::ns::myObj constructor runs in the ::ns::myObj:: namespace, not the ::ns:: namespace. This is extremely unlikely to change. I do agree, I would often find it convenient if ::ns::myObj's code could use any command from ::ns:: without having to import it or qualify it. I believe there's a TIP in progress which would allow me to tell Tcl that when it's in the ::ns::myObj:: namespace it should look for unqualified command names in ::ns::myObj, and then in ::ns::, and then in ::, instead of just in ::ns::myObj:: and ::. If that pans out, it would be an obvious enhancement--and one that I'd welcome. | |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki