What's the magic to using Incr Tcl



Hi,

I'm trying to learn to use the [incr Tcl] package and I seem to be
having some difficulty. I've downloaded a tutorial of sorts that I
found a link to from the main [incr Tcl] web site. It's called,
"Object-Oriented Programming with [incr Tcl]." I've figured out that
I must use a "package require Itcl" in my script to load the package.
however, then the interpreter bails saying that the command "class" is
unknown. I've also tried "Class" although none of the examples in
this tutorial use an upper case C in the word class.

So, after one brings in the functionality with "package require", how
does one actually use the package? I'm also using the manual pages on-
line from http://www.tcl.tk/man/itcl3.1/index.html and there it is
mentioned that the command name for class is "class". So, below is
the very simple script I've put together to familiarize myself with
this package, please tell me what I'm doing wrong.

Oh, nearly forgot, in case it's important, I'm using ActiveState TCL
on Windoze. Is it possible I'm getting the wrong package?

Thanks,
Andy

puts [package require Itcl]

Class myClass {
variable int

constructor { i } {
puts "C-tor for myClass called: setting int to $i"
set int $i
}

destructor {
obliterate
}

method SetInt { i } {
set int $i
}

method ShowInt { } {
puts $int
}

method obliterate { } {
puts "inside destructor: obliterate"
unset int
}
}

myClass mc1 78
mc1 ShowInt
mc1 SetInt 33421
mc1 ShowInt

delete object mc1

.



Relevant Pages

  • Re: SCSI spin down, definitive answer required
    ... You can run or compile debian packages on mandrake just fine. ... > because a package says IT needs something that YOU need it? ... scsi-spin.c: In function `int is_mounted': ...
    (comp.os.linux.misc)
  • Re: constants in java
    ... public static final int MAX_STU = 15; ... Let's call that package 'foo', ... Compiler error: ...
    (comp.lang.java.programmer)
  • Re: JTable cell selection is broken
    ... package test.table; ... public void actionPerformed{ ... public class MyModel implements Serializable { ... public int getColumnCount() { ...
    (comp.lang.java.gui)
  • Re: Whats the magic to using Incr Tcl
    ... does one actually use the package? ... variable int ... mc1 ShowInt ...
    (comp.lang.tcl)
  • Re: Executing DTS C#
    ... > public int gsmtcount; ... > public string serverName; ... > //Pass in the path of the file to the DTS Package ... > public void ExecutePackage ...
    (microsoft.public.sqlserver.dts)