Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 63d2d5512d9828ea852e4e287b13ebe59b7c12a8
Ticket: 1578344fffffffffffffffffffffffffffffffff
-exact version matching broken
User & Date: dgp on 2007-05-19 03:12:21
Changes

  1. icomment:
    Logged In: YES 
    user_id=80530
    Originator: YES
    
    
    Ok, I see (at least some of) the
    motivation for this now.  It comes
    down to a deficiency in the Tcl_InitStubs()
    interface.
    
    Consider Tk 8.4 as an example of a stubs
    enabled extension.  It calls
    
      Tcl_InitStubs(interp, TCL_VERSION, 1)
    
    The Tk header file forces TCL_VERSION
    to be "8.4", so this call is looking to
    initialize "exactly" version 8.4 of
    the Tcl stub table.
    
    Trouble is that the stub table itself
    does not include any version field.
    Instead the "version" of a stub table
    is implicitly taken to be the same
    as the version of the "Tcl" package
    in the same interp, via a call in
    Tcl_InitStubs:
    
      Tcl_PkgRequireEx(interp, "Tcl",
          version, exact, &pkgData);
    
    where version and exact have the
    values TCL_VERSION and 1 passed into
    Tcl_InitStubs originally.
    
    Since the history has been that
    Tcl only [package provide]d a
    Tcl version to M.m resolution, the
    implicit rule is that the Tcl stub
    table was version 8.4 throughout
    the entire 8.4* series of releases.
    
    This has a few implications.  First
    a value of 1 in the "exact" argument
    to Tcl_InitStubs() has always meant
    that any stub table from any 8.4*
    release of Tcl is acceptable, but
    that any table from 8.3* or 8.5*
    releases is not.  For extensions like
    Tk that may be accessing volatile internals,
    this is a good kind of requirement to be
    able to express.
    
    Note that the history of having a single
    version identifier for all the stub tables
    of all Tcl releases matching 8.4.*
    indicates that the stub table is meant
    to be unchanging through the whole
    8.4* series of releases.  Except for the
    backport of TIP 218, we've even honored
    that (in the default build anyway).
    
    After TIP 268, [package provide Tcl]
    now returns the full patchlevel version
    number.  Since the workings of
    Tcl_InitStubs() were not modified by
    that TIP, we now effectively have
    a new version of the stub table with
    every release of Tcl.  This means
    that Tcl_InitStubs() calls with exact=1
    can only match a single release of Tcl,
    which is not desirable.  Furthermore
    passing both TCL_VERSION and exact=1
    can only match the stub table to be
    found in Tcl 8.5.0 which does not yet
    exist.  This means without source code
    changes, Tk 8.5a6 could not [load] into
    any existing Tcl interp.
    
    Tk 8.5a6 has addressed this in part
    by changing its Tcl_InitStubs call to:
    
      Tcl_InitStubs(interp, TCL_PATCH_LEVEL, 1)
    
    With the traditional meaning of -exact
    matching, this would permit a Tk 8.5a6
    built against Tcl 8.5a6 header file to [load] into
    a Tcl 8.5a6 interp, but no other release at all.
    This level of lockstep forced even on the
    stubs interface is undesirable.
    
    The old ability of Tcl_InitStubs to
    approve the stub table of all Tcl
    releases match 8.5* was restored by
    the incomptible interpretation of
    -exact matching noted in the original
    bug report here.  It's an example
    of restoring one kind of compatibility
    by destroying another kind.
    
    I think for the 8.5 series of releases,
    this issue can successfully be solved
    by making appropriate changes to
    Tcl_InitStubs.  I'll be looking into that.
    
    
    
    
  2. login: "dgp"
  3. mimetype: "text/plain"
  4. username: "dgp"