Tcl question: expansion of variable names

Ryan Schmidt ryandesign at macports.org
Tue Sep 4 13:53:56 UTC 2018



On Sep 4, 2018, at 08:13, Mojca Miklavec wrote:

> Dear Joshua,
> 
> On Tue, 4 Sep 2018 at 14:04, Joshua Root wrote:
>> On 2018-9-4 19:15 , Mojca Miklavec wrote:
>>> Hi,
>>> 
>>> I would like to ask for some help making a little trick work. Here's
>>> my attempt of a PR:
>>>    https://github.com/macports/macports-ports/pull/2509/files
>>> 
>>> Each subport has a different checksum URL:
>>>    https://geant4.web.cern.ch/support/download_archive?page=0
>>>    https://geant4.web.cern.ch/support/download_archive?page=1
>>>    https://geant4.web.cern.ch/support/download_archive?page=2
>>> etc.
>>> 
>>> I would like to code this inside a table, but somehow I cannot figure
>>> out how to properly resolve the variable names when using this hack.
>> 
>> Wrapping a string in braces disables variable substitution. Use quotes,
> 
> Thank you, this worked.
> 
>> or better, the list command, if you want to set geant.versions_info to a
>> list with substituted variables.
> 
> This is where I'm not sure where or how to apply the list command. I
> tried a couple of ways, none of which worked :)

It should be a simple as replacing

set myvar "a b c"

with

set myvar [list a b c]

I've never been quite clear on the benefits of using [list] vs just making a string, since a string is a list, and I seem to use them interchangeably. 




More information about the macports-dev mailing list