View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] proper way to access xotcl classes

From: Matthew Smith <chedderslam_at_gmail.com>
Date: Thu, 8 May 2008 08:11:56 -0500

>
> Putting in:
> s1 push a
> results in an error, however I can do:
>
what is the error? this indicates that you have not defined the method push
correctly

I get:
 invalid command name "s1"
for:
s1 push 1
I get the same for:
xotcl::s1 push 1

On Thu, May 8, 2008 at 2:27 AM, Gustaf Neumann <neumann_at_wu-wien.ac.at>
wrote:

> Matthew Smith schrieb:
>
>> Thank you, Gustaf. Makes sense.
>>
>> Is there anyway to call a method besides doing a "puts".
>>
> sure.
>
>>
>> Putting in:
>> s1 push a
>> results in an error, however I can do:
>>
> what is the error? this indicates that you have not defined the method push
> correctly.
>
> puts [s1 pop]
>>
>> I would think that there would be a way to call a method without
>> outputiing. Is there one?
>>
> sure:
>
> set a [s1 pop]
>
> The method pop returns a value. The question is, what do you want to do
> in your application with the value. Technically, "s1" is a Tcl command
> (which happens to be an XOTcl object) that returns a value. By placing
> the tcl command between square braces, you will be performing
> "command substitution", which means "replace the command with
> the result of the command" during evaluation. Same mechanism as
>
> set x [expr {1+2}]
>
> or
>
> puts [expr {1+2}]
>
> hope this helps
>
> -gustaf neumann
>
>