Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 40f44154ff32925a3ee6be56d8a9ca1e232eef9f
Ticket: 781929ffffffffffffffffffffffffffffffffff
[lexpand] expand-in-place command
User & Date: muonics on 2003-08-08 21:27:51
Changes

  1. icomment:
    Logged In: YES 
    user_id=498198
    
    > Making that example work within the current syntax would
    > require [set] to expand its arguments, thus causing errors
    > in thing like
    >     set x [list 1 2 3]
    > Alternatively, [set] would need to know more about how each
    > word argument was generated (is it the resut of an
    > [lexpand]?)
    
    But it is by design that "set x [lexpand ...]" will cause an
    error.  Do you expect if TIP #144's syntax is adopted that
    any of these will succeed?
    
    set x {}[...]
    set x {}$y
    
    How about these, under current circumstances?
    
    eval set x [...]
    eval set x $y
    
    I very much doubt it!  What do these all have in common?  In
    every case you're telling Tcl to expand either the value of
    y or the result of [...] into multiple arguments before
    passing them to the set command.  All four of the above
    behave exactly the same (modulo needing to fix the bytecode
    issue) as:
    
    set x [lexpand [...]]
    set x [lexpand $y]
    
    (As for whether you want to say that alters Tcl's syntax, or
    as I see it that it alters the substitution rules a little
    but does not introduce new syntax, is largely matter of
    semantics.  I do not see it as altering the syntax because
    the parser remains unchanged, unlike the {} prefix proposal.
     [lexpand] is just [list] with a different object type, so
    it *is* just a command; it's just that this new object type
    is treated specially during evaluation.  Whether {} prefix
    or [lexpand] is adopted, however, either way the Endekalogue
    will have to be updated, so that's not in its self a logical
    reason to choose one over the other.)
    
    I think it would be a really bad idea for *either* the {}
    prefix or the [lexpand] command to cause that set to
    succeed, because that would amount to *two* changes to the
    Endekalogue, or at least inconsistent behavior: "if ... is
    used, the value is expanded into multiple arguments before
    passing to the command.  oh, unless that command is set." 
    Why would you want that, especially when that's not the
    behavior expected of eval set ...?
    
    
  2. login: "muonics"
  3. mimetype: "text/plain"
  4. username: "muonics"