Re: What's the magic to using Incr Tcl
- From: Helmut Giese <hgiese@xxxxxxxxxxxxx>
- Date: Fri, 29 Jun 2007 17:30:43 +0200
Hi Andrew,
So, after one brings in the functionality with "package require", howas with any package
does one actually use the 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
.
- Follow-Ups:
- Re: What's the magic to using Incr Tcl
- From: Larry W. Virden
- Re: What's the magic to using Incr Tcl
- References:
- What's the magic to using Incr Tcl
- From: Andrew Falanga
- What's the magic to using Incr Tcl
- Prev by Date: Re: What's the magic to using Incr Tcl
- Next by Date: Re: tiny improvement of text widget ?
- Previous by thread: Re: What's the magic to using Incr Tcl
- Next by thread: Re: What's the magic to using Incr Tcl
- Index(es):
Relevant Pages
|