[Xotcl] proper way to access xotcl classes

Matthew Smith chedderslam at gmail.com
Thu May 8 15:11:56 CEST 2008


>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://alice.wu-wien.ac.at/pipermail/xotcl/attachments/20080508/7fc660dd/attachment.html 


More information about the Xotcl mailing list