Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2fe10d8f36f4006f43aaa62f148cb55eed9e5a3f
Ticket: 827119ffffffffffffffffffffffffffffffffff
TIP 157 implementation - {expand}
User & Date: dkf on 2003-10-25 05:27:13
Changes

  1. icomment:
    Logged In: YES 
    user_id=79902
    
    I suspect that we could use a better compilation strategy
    than purely list concatenation, as that does a lot of
    object-churn.  My idea goes something like this:
    Two new opcodes (though one might be simulatable using
    existing opcodes - I don't know for sure):
    INST_VERIFY_LIST and INST_EXPAND_STK (might want it in 1/4
    forms).
    INST_VERIFY_LIST checks that the object on the top of the
    stack is a list; it *doesn't* pop anything off the stack,
    but it throws an error if it isn't a list at the stack top.
    INST_EXPAND_STK has one immediate value which is the number
    of words to evaluate (much as in INST_INVOKE_STK) but it
    also reads an additional object off the top of the stack
    (not counted?) which is a *sorted* list of integer indices
    to expand.
    
    Compilation proceeds as follows:
    Generate words for command execution as normal.  If any of
    the words are expanded, add a trailing INST_VERIFY_LIST
    (required for correct functioning of basic-48.19.*) and
    append the index of the word within the whole command
    invokation to a list you are building.  If at the end of the
    command you've got a non-empty list, push the list (which is
    guaranteed to be sorted ints) and use INST_EXPAND_STK
    instead of INST_INVOKE_STK. This simplifies the compiler
    *and* allows for a more efficient strategy for use of
    temporary space when building the actual list of argument
    objects.
    
    I proposed such a strategy for expansion compilation back in
    the discussions for TIP#144 on tcl-core
    
    
  2. login: "dkf"
  3. mimetype: "text/plain"
  4. username: "dkf"