From: Zbigniew Diaczyszyn on 1 Mar 2010 16:01 Perhaps someone could explain to me why calling proc Save {} { set fh [ open "test" "w" ] puts $fh message close $fh } Save is working, but: namespace eval textile {} proc textile::Save {} { set fh [ open "test" "w" ] puts $fh message close $fh } textile::Save shows the error: <wrong # args: should be "open">
From: Alexandre Ferrieux on 1 Mar 2010 16:28 On Mar 1, 10:01 pm, Zbigniew Diaczyszyn <z....(a)gmx.de> wrote: > Perhaps someone could explain to me why calling > > proc Save {} { > set fh [ open "test" "w" ] > puts $fh message > close $fh} > > Save > > is working, but: > > namespace eval textile {} > > proc textile::Save {} { > set fh [ open "test" "w" ] > puts $fh message > close $fh} > > textile::Save > > shows the error: <wrong # args: should be "open"> Most likely you have a textile::open taking no arguments. The snippet above doesn't generate any error when run in isolation. -Alex
From: Glenn Jackman on 1 Mar 2010 16:47 At 2010-03-01 04:28PM, "Alexandre Ferrieux" wrote: > On Mar 1, 10:01�pm, Zbigniew Diaczyszyn <z....(a)gmx.de> wrote: > > Perhaps someone could explain to me why calling > > > > proc Save {} { > > � � �set fh [ open "test" "w" ] > > � � �puts $fh message > > � � �close $fh} > > > > Save > > > > is working, but: > > > > namespace eval textile {} > > > > proc textile::Save {} { > > � � �set fh [ open "test" "w" ] > > � � �puts $fh message > > � � �close $fh} > > > > textile::Save > > > > shows the error: <wrong # args: should be "open"> > > Most likely you have a textile::open taking no arguments. > The snippet above doesn't generate any error when run in isolation. Meaning, the call to "open" should really be "::open" You have to be a bit careful calling Tcl core commands when inside a namespace. -- Glenn Jackman Write a wise saying and your name will live forever. -- Anonymous
|
Pages: 1 Prev: TCL scripting help Next: RESULT: comp.lang.tcl.announce will be removed |