reinplace question

Rainer Müller raimue at macports.org
Fri Mar 20 18:25:33 PDT 2009


Bradley Giesbrecht wrote:
> This is what I ended up with to escape double quotes. I'm sure someone  
> here will show me a better way.
> 
>     set CCARGS      [concat ${CCARGS} -DUSE_SASL_AUTH - 
> DDEF_SERVER_SASL_TYPE=\\\\\\"dovecot\\\\\\"]

First, there is usually no need to do:
  set foo [concat $foo bar]
You can use append for strings and lappend for lists instead:
  lappend foo bar

In this specific case, I don't know why you had to put that many
backslashes there. How is it used further?

It can also end in funny results if you try to use a list as a string
without using join. See this short tclsh example for the difference:

$ tclsh
% set foo "bar"
bar
% lappend foo baz="qux"
bar baz=\"qux\"
% puts $foo
bar baz=\"qux\"
% puts [join $foo]
bar baz="qux"

The last thing is probably what you expected here.

Rainer


More information about the macports-dev mailing list