2015-05-15
| ||
14:02 | • Closed ticket [9dd1bd7a74]: self returns empty string in destructor when constructing fails plus 6 other changes 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 fails status still Open with 6 other changes 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 | Version: | 1.0.1 | |
Submitter: | anonymous | Created on: | 2015-05-12 16:04:44 | |
Subsystem: | 35. TclOO Package | Assigned To: | dkf | |
Priority: | 8 | Severity: | Severe | |
Status: | Closed | Last Modified: | 2015-05-15 14:02:24 | |
Resolution: | Fixed | Closed By: | dkf | |
Closed on: | 2015-05-15 14:02:24 | |||
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 14:02:24:
Should be fixed in Tcl 8.6 and next release of TclOO package. 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. |