modern Tcl and correct quoting

Joshua Root jmr at macports.org
Wed Jun 12 16:02:35 PDT 2013


On 2013-6-13 06:58 , Clemens Lang wrote:
> Hi,
> 
> On Wed, Jun 12, 2013 at 04:33:56PM -0400, Lawrence Velázquez wrote:
>> Note that changing something like
>>     if {$whatever == "yes"} { foo } else { bar }
>> into
>>     if {$whatever} { foo } else { bar }
>> subtly changes the semantics of the conditional. This transformation
>> is only valid if $whatever is certain to be a valid Tcl boolean.
> 
> I think we do have [tbool whatever] for that, we're just not using it
> everywhere we could.

That's also a little odd. It does this:

[string equal -nocase [set $key] "yes"]

which seems like it should really be something like this:

[string is true [set $key]]

- Josh


More information about the macports-dev mailing list