Link to home
Start Free TrialLog in
Avatar of HonorGod
HonorGodFlag for United States of America

asked on

Please explain this unexpected syntax

I have encountered some TCL code (well, Jacl code really), that has the statements shown below.

I understand that #1 creates a new java Object, having a value of 1.  So far, so good.

What I don't understand is the 2nd statement.  I'm used to seeing

set variableName value

So what is this doing?

set 0 value

and why is this after a dereferenced variable?

If you could explain this, and provide equivalent Jython, it would be greatly appreciated.

Thanks
set params [java::new {java.lang.Object[]} {1}]
$params set 0 [java::field com.ibm.websphere.scheduler.BeanTaskInfo class]

Open in new window

Avatar of HonorGod
HonorGod
Flag of United States of America image

ASKER

Here's the "equivalent" Jython code...


import com.ibm.websphere.scheduler as sch
 
params = [ sch.BeanTaskInfo ];    # class reference
sigs   = [ 'java.lang.Class' ];   # "Signature" identifying "params" type

Open in new window

SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
According to the Tcl documentation, one would use the "array" keyword to define an array.

So, I'm still confused.
array set colorcount {
    red   1
    green 5
    blue  4
    white 9
}

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
mish33 was completely correct, so gets most of the points.
objects was first, and partially correct, so get some of the points.

Thanks again folks!