Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is 'namespace export ' necessary in TCL?

Tags:

namespaces

tcl

Is 'namespace export ... ' necessary, in order to use the variable/procs of that namespace in a different namespace using the 'namespace import *' command. Should we really do the 'export' in the source namespace and 'import'in the destination namespace.

like image 832
chidambar181 Avatar asked Nov 04 '22 10:11

chidambar181


1 Answers

All namespace export does is make commands available for namespace import and prompts them to appear in a simple-mode namespace ensemble (though you've got other options for that). If you don't want to support namespace import, you don't have to; just never export anything.

You invoke commands in another namespace using the fully-qualified syntax:

::the::other::namespace::command "some argument, as normal"

You can also use partial namespace names; that's pretty common as a leading :: is a bit ugly...

like image 181
Donal Fellows Avatar answered Nov 17 '22 09:11

Donal Fellows