modern Tcl and correct quoting
Clemens Lang
cal at macports.org
Wed Jun 12 02:30:54 PDT 2013
On Wed, Jun 12, 2013 at 06:05:22AM +0000, Poor Yorick wrote:
> macport.tcl appears to have originally been written prior to Tcl 8.5,
> which was released in 2007, and uses idioms that are now considered
> obsolete. There are also instances where curly brackets are used in
> combination with variable interpolation to attempt to create a
> well-formed list value, but this is not robust.
Thanks, this is a good idea. However, as Ryan already pointed out we
still want to be compatible with Tcl 8.4 as shipped with some older
releases of OS X.
> replace [eval] with {*} expansion where appropriate
I think that doesn't work in Tcl 8.4, does it?
> I hope the macports team will see fit to modernize its Tcl code. If
> these changes are accepted, I would be happy to make the same effort
> with other .tcl files in the project.
I'm all for integrating this, if it's Tcl 8.4-compatible.
> The implementation of [system] curently passes its commands through a
> shell, but this makes it necessary to add an extra layer of shell
> quoting to the arguments to [system]. Macports currently includes no
> [shquote] command, so extra layer of quoting has been manually
> hard-coded into the values that are passed, which is not correct and
> only works if one steers clear of the edge cases. [system] could be
> implemented so that it bypasses the shell, which would be more simple
> and robust.
If that doesn't break any ports, why not. Manually implementing walking
through $PATH doesn't seem very comfortable to me, though. I also agree
we should have an shquote command.
> macports_util.tcl implements [try], which, as of Tcl 8.6, is included
> as a built-in command. In my development environment, this leads to
> an error when [package require] is invoked. I propose to rename the
> macports [try] so that it can coexist with the builtin.
Yes, this is probably also a good idea. We could also rewrite all places
where a try-catch block is being used to the new Tcl 8.6 semantics of
the command and provide a fallback implementation for Tcl < 8.6.
--
Clemens Lang
More information about the macports-dev
mailing list