Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6fa09f1082c8cc53e3f5baf0d72d73d479a5b994
Ticket: 1577282fffffffffffffffffffffffffffffffff
TIP 283: ensemble's command resolution
User & Date: msofer on 2006-11-02 03:40:27
Changes

  1. icomment:
    Logged In: YES 
    user_id=148712
    
    Updated patch that works in HEAD. It breaks test cmdAH-24.12
    in a weird manner - by breaking autoloading of [clock scan].
    The reason is exposed below; the problem with clock can be
    fixed easily, but the wider problem may be more important.
    
    *** DANGER ***
    
    As the "fix" for [info level] in HEAD was reverted (Bug
    1577492, previously called "let [info level] know ensemble
    rewrites"), this new feature breaks nother usual idiom.
    
      'uplevel 1 [info level 0]' is NOT GUARANTEED to call the
    present proc again
    
    This is because:
    (a) 'namespace ensemble' does not push a new frame
    (b) 'namespace ensemble' calls by simple name (non qualified)
    (c) 'info level 0' reflects only the actual call, ie, a
    simple name
    
    As an illustration, with this patch we get:
    
    % namespace eval a {
        variable ct 0
        namespace ensemble create -map {x scan}
        proc scan args {
            variable ct
            if {$ct} {
                puts YES
                return
            }
            incr ct
            uplevel 1 [info level 0]
        }
    }
    % a x
    wrong # args: should be "scan string format ?varName varName
    ...?"
    
    
  2. login: "msofer"
  3. mimetype: "text/plain"
  4. username: "msofer"