BUG/PROBLEM: Tcl8.0b1 namespace children/delete {} in a namespace 
Author Message
 BUG/PROBLEM: Tcl8.0b1 namespace children/delete {} in a namespace

The following illustrated what is either a bug in the namespace children
command, or the man page related to it, along with a related potential
problem.

Background: I was expecting '{}' to refer to the current namespace when
running some namespace commands from the primary namespace and from child
namespaces.  I found that this worked for the primary namespace, but not
child namespaces (there actually is an implicit {} primary namespace - but
watch out for deleting it).

###### BEGIN TEST CODE ######
# create a namespace
(jhobbs) 11 % namespace foobar {}

# obviously there is nothing in it, but I was just testing...
(jhobbs) 12 % namespace foobar {namespace children {}}
unknown namespace "" in namespace children command

# this one works, returning nothing
(jhobbs) 13 % namespace foobar {namespace children}

# eval'ed in the primary namespace, this works
(jhobbs) 14 % namespace children {}
::foo ::foobar

# and so does this
(jhobbs) 15 % namespace children
::foo ::foobar

# no problem here
(jhobbs) 16 % namespace delete ::foo ::foobar

# this is sort of expected, see later notes
(jhobbs) 17 % namespace children

# this one isn't recommended (might cause "oh sh*t" response)
(jhobbs) 18 % namespace delete {}
###### END TEST CODE ######

OK, so if {} isn't going to be recognized as the current namespace, that
should be consistent.  The fact that there is an implicit {} primary
namespace is OK, but why not make it explicit (by returning it in the
namespace children command or stating it in the docs).  The fact that
namespace delete allows you to delete it is BAD because all of a sudden you
can't do anything, although the process exists (done in straight tclsh,
you'll have to ^c to get out).

I think it would be best to allow {} to represent the current namespace
when passed to the namespace command, but also that namespace delete should
not be allowed to affect {} (makes it harder to{*filter*}yourself).

--

  Software Engineer, Oregon R&D        office: 541.683.7891
  CADIX International, Inc.            fax:    541.683.8325
             URL: http://www.*-*-*.com/ ~jhobbs/



Wed, 24 Nov 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Possible Bug Report: Tcl8.0b1 namespaces

2. Tcl8.0b1 patch to allow widget creation in namespaces

3. Bug: Package and namespace problems in tcl8.0p1

4. interp delete bug in tcl8.0b1 ?

5. Problem with using a Namespace variable in another namespace function

6. BUG in tcl8.3.0 - namespace import

7. BUGS?: Tcl8 "namespace" quirks

8. tcl8.0b2 namespace command resolution bug

9. tcl8.0b2 namespace command resolution bug (FIX).

10. Problems deleting widget toolbar in namespace

11. Bug report: http_get/fcopy problem on NT, tcl8.0b1

12. Namespaces in Scheme vs. Namespaces in CL.

 

 
Powered by phpBB® Forum Software