#3780 [namespace code] doc improvement

obsolete: 8.5a7
closed-fixed
8
2007-10-27
2007-09-05
Don Porter
No

"For example, suppose the command
set script [namespace code {foo bar}]
is invoked in namespace ::a::b.
Then eval "$script x y"
can be executed in any namespace (assuming the value of
script has been passed in properly)
and will have the same effect as the command
::namespace eval ::a::b {foo bar x y}."

For literal values like "x" and "y" this
advice is fine, but for a value containing
substitution characters, this doesn't work.
In order to prevent the substitution from
happening, the "..." quoting has to be rejected
as the script building tool. This leaves
us with the safer [list]-based building schemes.

eval $script [list x y]

or

eval [linsert $script end x y]

are more generally correct solutions.

Discussion

  • Joe English

    Joe English - 2007-09-05

    Logged In: YES
    user_id=68433
    Originator: NO

    I don't think the docs currently guarantee that

    eval [linsert $script end x y]

    shall work. However, it happens to be true, and it would be a good thing to guarantee.

     
  • miguel sofer

    miguel sofer - 2007-09-13
    • milestone: --> obsolete: 8.5a7
    • priority: 5 --> 8
     
  • miguel sofer

    miguel sofer - 2007-10-27
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks