No registered users in community xowiki
in last 10 minutes
in last 10 minutes
Re: [Xotcl] proper way to access xotcl classes
From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Thu, 08 May 2008 09:27:16 +0200
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
Date: Thu, 08 May 2008 09:27:16 +0200
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