|
2016-07-05
| ||
| 05:00 | • Closed ticket [ef422602e7]: TclOO oo::objdefine variable plus 6 other change... artifact: 9b9d9a15b7 user: aspect | |
| 04:51 | • Deleted ticket [c4665869a7]: TclOO oo::objdefine variable plus 6 other chang... artifact: 7cee8a6415 user: aspect | |
|
2016-07-04
| ||
| 18:45 | • New ticket [ef422602e7] TclOO oo::objdefine variable. artifact: 078e07f082 user: anonymous | |
TclOO oo::objdefine variable
Closed / Invalidef422602e77616a686549b20985e0e5bf8296eaaCreated 10 years agoUpdated 10 years ago
Descriptionplain2016-07-04 18:45:14
oo::class create A {
constructor {} {
oo::objdefine [self] variable var
set var something
}
method a {} {
puts $var
}
}
[A new] a
Referenced by1
7cee8a6415Deleted ticket [c4665869a7]: TclOO oo::objdefine variable plus 6 other changes ticket2016-07-05 04:51:15
aspectplain2016-07-05 05:00:22
This is behaving as intended, though it might be surprising without a close reading of http://www.tcl.tk/man/tcl/TclCmd/define.htm#M30 to see: > This slot (see SLOTTED DEFINITIONS below) arranges for each of the named variables to be automatically made available in the methods declared by the object being defined. oo::define variable - makes variables automatically visible in methods defined on the same class. oo::objdefine variable - makes variables automatically visible in methods defined _on the object_. https://wiki.tcl.tk/41708 and particularly http://www.magicsplat.com/articles/oo.html deal with this in more detail.
Log in (anonymous is fine) to add a comment.