Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: cbc24b2a1cb98d246dc7bb934cb5d6ed071355c6
Ticket: 633204ffffffffffffffffffffffffffffffffff
catch { return foo } breaks inside proc
User & Date: dgp on 2002-12-19 00:42:10
Changes

  1. icomment:
    Logged In: YES 
    user_id=80530
    
    The patch defines a new opcode in
    the bytecode execution engine.
    In order to maintain compatibility
    with external bytecode brought in
    by tbcload, new opcodes can only
    be defined for a new minor release
    of Tcl, so this patch can't be applied
    until 8.5 development.
    
    So,
    1. Can't add an opcode.
    2. No existing opcode returns TCL_RETURN,
    Therefore,
    the only correct fix that can be applied in the
    8.4.x timeframe is to disable bytecompiling
    of [return].
    
    A workaround that would still be buggy, but
    would correct the reported example script,
    would be to add special detection of an
    enclosing [catch] in TclCompileReturnCmd()
    and return TCL_OUT_LINE_COMPILE in
    that case.
    
    The remaining bug after that workaround
    would be harder to demo.  TEBC and
    TclCompEvalObj() should evaluate general
    Tcl scripts.  The bug is that they are
    implicitly converting TCL_RETURN to TCL_OK,
    as if they were only good for evaluating proc
    bodies.  This bug might still be exposed by
    C code that calls Tcl_EvalObjEx().
    
    Better to get to 8.5 development and get
    the correct fix in the BC engine with the
    new opcode.
    
    
  2. login: "dgp"
  3. mimetype: "text/plain"
  4. username: "dgp"