[Xotcl] RE: [Xotcl] Probable bug: no method calls with "next" & init

Kristoffer Lawson setok at fishpool.com
Mon Feb 5 22:28:30 CET 2001


On Mon, 5 Feb 2001, Rick Hedin wrote:

> Hi Kristoffer.  
> 
> This behavior seems correct.  You are trying to pass three arguments:  
> 
> 	1. myArg  2. -whatever  3. niceSystem
> 
> to one formal parameter:
> 
> 	arg
> 
> We could send one argument:
> 
> 	next {myArg -whatever niceSystem}
> 
> or use the special properties of the args keyword:  
> 
> 	Foo instproc init {args} {  . . . 
> 
> Am I looking at this right?  

No, that wasn't the point. When normally creating an object you
can call other methods along with the initialisation procedure
(this is mentioned in the section of the tutorial about parameters,
IIRC). So the following works:

Class Foo 
Foo instproc init {arg} {
  puts "arg: $arg"
}
Foo instproc anotherMethod {param} {
  puts "param: $param"
}

set foo [Foo new initArg -anotherMethod methodParam]

Output:
param: methodParam
arg: initArg

This can often be extremely handy (and a nice feature of XOTcl). But
apparently this does not work with [next] and init. It's not exactly
documented that it doesn't work, but it would feel natural to assume that.

         -     ---------- = = ---------//--+
         |    /     Kristoffer Lawson      |  www.fishpool.fi|.com
         +-> |    setok at fishpool.com       |  - - --+------
             |-- Fishpool Creations Ltd - /         |
             +-------- = - - - = ---------      /~setok/





More information about the Xotcl mailing list