Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 39b5cf855e8361c4a5e8d8ebbd4b2450ac508e86
Ticket: d87cb182053fd79b3fc16054526620f2dfb25d96
inconsisency in behaviour of tailcall from (builtin) namespace ensembles
User & Date: pooryorick on 2015-03-19 13:31:08
Changes

  1. icomment:
    Here is the example, correcting what were likely a few typos/omissions.  It illustrates the same unexpected behaviour:
    
    # tailcall and uplevel identity:
    proc it {} {
        tailcall try {
            puts it:[::incr x]
        }
    }
    proc iu {} {
        uplevel 1 {
            puts iu:[::incr x]
        }
    }
    
    proc aa {} {
        it
        iu
        return $x
    }
    
    puts aa:[aa]        ;# it:1 iu:2 aa:2 - as expected
    
    
    # now try in an ensemble:
    namespace eval ens {
        namespace ensemble create
    }
    namespace ensemble configure ens -map {it ::it iu ::iu}
    
    proc ab {} {
        ens it
        ens iu
        return $x
    }
    
    puts ab:[ab]        ;# it:1 iu:2 ab:2 - as expected
    
    
    # now try with an existing ensemble:
    set map [namespace ensemble configure dict -map]
    dict set map it ::it
    dict set map iu ::iu
    namespace ensemble configure dict -map $map
    
    proc ac {} {
        dict it
        dict iu
        return $x
    }
    
    puts ac:[ac]        ;# iu:1 it:1 ac:  - not at all as expected!
    
  2. login: "pooryorick"
  3. mimetype: "text/plain"