Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 238737f1d70df3d74faba605efc8a64a158c3160
Ticket: 9dd1bd7a74bc6e9e3e1c0bfd97c42d2df7bacc1f
[self] returns empty string in destructor when constructing fails
User & Date: anonymous on 2015-05-12 16:04:44
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    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'.
    ~~~
    
  5. foundin changed to: "1.0.1"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "3410fe6f8504d01909e548b02e0cec50a5f7fab3"
  10. resolution changed to: "None"
  11. severity changed to: "Severe"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "35. TclOO Package"
  15. title changed to:
    [self] returns empty string in destructor when constructing fails
    
  16. type changed to: "Bug"