Overview
| Artifact ID: | 82442b9c65c417a0fd2d6639f3e2fc585b0a66d4 |
|---|---|
| Ticket: | 684534ffffffffffffffffffffffffffffffffff
[lconvert] command, expands lists inline |
| User & Date: | nobody on 2003-02-11 11:46:22 |
Changes
- assignee changed to: "msofer"
- cmimetype changed to: "text/plain"
- comment changed to:
This patch adds a new command called [lconvert] and a new Tcl_ObjType, "plist". A "plist" or "parameter list" is identical to a list with the following LARGE exception: when a "plist" is used in ANY command, it is expanded. The syntax of [lconvert] is as follows: lconvert varName ?type? where "varName" is the name of a pre-existing LIST or PLIST variable to convert. where "type" is optional and if specified, must be "list" or "plist". if "type" is omitted, the current type of the list variable is returned, otherwise, the newly converted list is returned. an error is returned if you try to convert a non-list, a non-existant variable, or if you try to convert a list to the type it currently is. WARNING: This patch MAY VERY WELL break a lot of things. It is meant only as a proof-of-concept. If and when all the quirks are worked out, a TIP will be forthcoming. --------------------------------------- For example: % set x [list 1 2 3 4] 1 2 3 4 % lconvert x plist 1 2 3 4 % file join $x 1/2/3/4 Normally, [file join] takes a variable number of arguments and joins them together with a path separator. In this case, we only passed one real argument (a "plist") and it was expanded automatically to four "real arguments". This can also be accomplished with [eval], although that is not as safe: % set x [list 1 2 3 4] 1 2 3 4 % eval file join $x 1/2/3/4 For more information, please see the Wiki page at: http://wiki.tcl.tk/lconvert -- JJM
- foundin changed to: "None"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "45. Parsing and Eval"
- title changed to: "[lconvert] command, expands lists inline"
- type changed to: "Patch"