[Xotcl] proper way to access xotcl classes

Gustaf Neumann neumann at wu-wien.ac.at
Thu May 8 09:27:16 CEST 2008


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



More information about the Xotcl mailing list