|
2015-05-15
| ||
| 14:02 | • Closed ticket [9dd1bd7a74]: self returns empty string in destructor when const... artifact: ea9a0c49ed user: dkf | |
| 13:55 | • Ticket [9dd1bd7a74]: 3 changes artifact: b56f111c0b user: dkf | |
| 13:54 | [9dd1bd7a74] Ensure that [self] returns a sensible value in a destructor even when construction didn... check-in: b055612dca user: dkf tags: trunk | |
| 13:26 | • Ticket [9dd1bd7a74] self returns empty string in destructor when constructing ... artifact: 86b3afc962 user: dkf | |
|
2015-05-12
| ||
| 16:04 | • New ticket [9dd1bd7a74]. artifact: 238737f1d7 user: anonymous | |
| Ticket UUID: | 9dd1bd7a74bc6e9e3e1c0bfd97c42d2df7bacc1 | ||
| Title: | [self] returns empty string in destructor when constructing fails | ||
| Type: | Bug | Created on: | 2015-05-12 16:04:44 |
| Submitter: | anonymous | Assigned to: | dkf |
| Subsystem: | 35. TclOO Package | Severity: | Severe |
| Priority: | 8 | Last modified: | 2015-05-15 14:02:24 |
| Status: | Closed | Closed by: | dkf |
| Resolution: | Fixed | Closed on: | 2015-05-15 14:02:24 |
| Version: | 1.0.1 | ||
| Description: | ||||
Invoking [self] in the destructor returns an empty string if an error was raised in the constructor, except if [self] had been invoked in the constructor prior to the error. Please, see following recipe to reproduce:
~~~
# TclOO bug. [self] returns no value on the destructor if:
# - There is an error while constructing the object.
# - [self] is not invoked prior to the error.
::oo::class create noself {
constructor {args} {
error "Some error in NOSELF constructor.";
}
destructor {
puts "I have no self='[self]'.";
}
}
::oo::class create yesself {
constructor {args} {
self;
error "Some error in the YESSELF constructor after invoking \[self\].";
}
destructor {
puts "I do have self='[self]'.";
}
}
catch {noself new};
catch {yesself new};
~~~
The script outputs the following:
~~~
I have no self=''.
I do have self='::oo::Obj24'.
~~~
| ||||
| User Comments: | ||||
dkf added on 2015-05-15 13:26:07:
Good catch; it's a race between the construction of the name and the deletion, with some traces in the mix too to make it all complicated. dkf added on 2015-05-15 14:02:24:
Should be fixed in Tcl 8.6 and next release of TclOO package. | ||||
