Re: What's the magic to using Incr Tcl



Hi Andrew,
So, after one brings in the functionality with "package require", how
does one actually use the package?
as with any package
- you either import the names
- or you prefix each command which you use with its proper namespace.
Ok, it's a bit unfortunate that the package is called Itcl (upper case
'I') and the namespace is 'itcl' (lower case 'i') - but that's nothing
you or I can change.

In your example below the changes would be
- itcl::class (note: lower case 'class') and
- itcl::delete

HTH
Helmut Giese

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

  • Whats the magic to using Incr Tcl
    ... I'm trying to learn to use the [incr Tcl] package and I seem to be ... I must use a "package require Itcl" in my script to load the package. ... variable int ... mc1 ShowInt ...
    (comp.lang.tcl)
  • 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: 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)