From: Zbigniew Diaczyszyn on
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
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
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