From: <no...@so...> - 2001-12-05 22:08:05
|
Bugs item #489537, was opened at 2001-12-05 12:56 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=110894&aid=489537&group_id=10894 Category: 10. Objects Group: 8.4a4 Status: Open Resolution: None Priority: 1 Submitted By: Don Porter (dgp) Assigned to: miguel sofer (msofer) Summary: string rep of list: should quote '#' Initial Comment: Kudos to Joe English for catching this one, and Donal Fellows for analyzing the right solution. list(n) says: list ?arg arg ...? Braces and backslashes get added as necessary,... so that eval may be used to execute the resulting list, with arg1 comprising the command's name and the other args comprising its arguments. However, in an interacive tclsh: % proc # {} {puts !} % set cmd [list #] # % eval $cmd % A patch is attached that offers one fix with changes to Tcl_{Scan|Convert}CountedElement. It is overkill in that it quotes leading '#' in all list elements when it is only needed for the first list element, but in those routines, the ordinal of the element is not known. Perhaps an additional flag value could be added if more sophistication is wanted, limiting the quoting to the first element. Two part.test tests were updated, and tests based on the demo above was added to util.test. ---------------------------------------------------------------------- >Comment By: Jeffrey Hobbs (hobbs) Date: 2001-12-05 14:07 Message: Logged In: YES user_id=72656 The patch changes semantics to the following: [list #foo a b c] == {\#foo a b c} by placing the \ in front of the #. This means that #foo will now be seen as a command, but when it is not (in most cases # will be for comments), then you will throw an error, no? ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2001-12-05 13:13 Message: Logged In: YES user_id=80530 Example? ---------------------------------------------------------------------- Comment By: Jeffrey Hobbs (hobbs) Date: 2001-12-05 13:10 Message: Logged In: YES user_id=72656 This is not correct for most cases, where the # is really meant to be a quote and has no command associated with it. This is only valid for the rare cases where the initial #- starting element has a command of the same name. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=110894&aid=489537&group_id=10894 |