No registered users in community xowiki
in last 10 minutes
in last 10 minutes
RE: [Xotcl] [Fwd: Bug with namespace'd Class?]
From: Damon Courtney <damon-xotcl_at_tclhome.com>
Date: Tue, 2 Nov 2004 14:26:56 -0600 (CST)
I figured as much. I guess I'll just do import the commands into the
root namespace. It doesn't really bother me, but some of the other
Tcl'ers are real sticklers about namespacing everything. I just use
what's best. 0-]
So, does this still constitute a bug then, or should I just chalk it
up to expected behavior?
Thanks,
Damon
> because "self" is a command in the xotcl namespace. you will also find
> that there are others, such a "my"
>
> If you don't import xotcl, you end up with source that looks like this:
>
> ::xotcl::Class foo
> Foo instproc bar {} {
> puts "[::xotcl::self] is a [::xotcl::my info class]"
> }
>
>
> I'd suggest, do something like the following...
>
> package require XOTcl 1.3
> namespace eval fooPackage {
> namespace import ::xotcl::*
> Class Foo
> Foo instproc bar {} {
> puts "[self] is a [my info class]"
> }
> }
>
>
> hope that helps.
> -- bryan
>
>> -----Original Message-----
>> From: xotcl-bounces_at_alice.wu-wien.ac.at
>> [mailto:xotcl-bounces_at_alice.wu-wien.ac.at]On Behalf Of Damon Courtney
>> Sent: Tuesday, November 02, 2004 2:23 PM
>> To: xotcl_at_alice.wu-wien.ac.at
>> Subject: [Xotcl] [Fwd: Bug with namespace'd Class?]
>>
>>
>> Why does this not work?
>>
>> package require XOTcl
>>
>> ::xotcl::Class Foo
>>
>> Foo instproc bar {} {
>> puts "SELF = [self]"
>> }
>>
>> Foo foo
>> % Foo foo
>> ::foo
>> % foo bar
>> invalid command name "self"
>>
>>
>> But, if I "namespace import ::xotcl::*" and make the
>> class with just
>> the Class command (not ::xotcl::Class), it works.
>>
>> Any ideas?
>>
>> D
>>
>> PS: Windows, Tcl 8.4.3, XOTcl 1.3.1
>>
>> _______________________________________________
>> Xotcl mailing list
>> Xotcl_at_alice.wu-wien.ac.at
>> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>>
>
> _______________________________________________
> Xotcl mailing list
> Xotcl_at_alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>
Date: Tue, 2 Nov 2004 14:26:56 -0600 (CST)
I figured as much. I guess I'll just do import the commands into the
root namespace. It doesn't really bother me, but some of the other
Tcl'ers are real sticklers about namespacing everything. I just use
what's best. 0-]
So, does this still constitute a bug then, or should I just chalk it
up to expected behavior?
Thanks,
Damon
> because "self" is a command in the xotcl namespace. you will also find
> that there are others, such a "my"
>
> If you don't import xotcl, you end up with source that looks like this:
>
> ::xotcl::Class foo
> Foo instproc bar {} {
> puts "[::xotcl::self] is a [::xotcl::my info class]"
> }
>
>
> I'd suggest, do something like the following...
>
> package require XOTcl 1.3
> namespace eval fooPackage {
> namespace import ::xotcl::*
> Class Foo
> Foo instproc bar {} {
> puts "[self] is a [my info class]"
> }
> }
>
>
> hope that helps.
> -- bryan
>
>> -----Original Message-----
>> From: xotcl-bounces_at_alice.wu-wien.ac.at
>> [mailto:xotcl-bounces_at_alice.wu-wien.ac.at]On Behalf Of Damon Courtney
>> Sent: Tuesday, November 02, 2004 2:23 PM
>> To: xotcl_at_alice.wu-wien.ac.at
>> Subject: [Xotcl] [Fwd: Bug with namespace'd Class?]
>>
>>
>> Why does this not work?
>>
>> package require XOTcl
>>
>> ::xotcl::Class Foo
>>
>> Foo instproc bar {} {
>> puts "SELF = [self]"
>> }
>>
>> Foo foo
>> % Foo foo
>> ::foo
>> % foo bar
>> invalid command name "self"
>>
>>
>> But, if I "namespace import ::xotcl::*" and make the
>> class with just
>> the Class command (not ::xotcl::Class), it works.
>>
>> Any ideas?
>>
>> D
>>
>> PS: Windows, Tcl 8.4.3, XOTcl 1.3.1
>>
>> _______________________________________________
>> Xotcl mailing list
>> Xotcl_at_alice.wu-wien.ac.at
>> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>>
>
> _______________________________________________
> Xotcl mailing list
> Xotcl_at_alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>