Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

19 May, 2024: Line wrapping has been changed to be more consistent with Usenet standards.
 If you find that it is broken please let me know here rocksolid.nodes.help


devel / comp.lang.tcl / Why do I get accolades

SubjectAuthor
* Why do I get accoladesCecil Westerhof
+* Re: Why do I get accoladesCecil Westerhof
|+- Re: Why do I get accoladessaitology9
|`* Re: Why do I get accoladesCecil Westerhof
| `- Re: Why do I get accoladesRich
+* Re: Why do I get accoladessaitology9
|`* Re: Why do I get accoladesCecil Westerhof
| `- Re: Why do I get accoladesRich
+- Re: Why do I get accoladesRich
`* Re: Why do I get accoladesHarald Oehlmann
 `* Re: Why do I get accoladesCecil Westerhof
  `- Re: Why do I get accoladesRich

1
Why do I get accolades

<87pmff6txs.fsf@munus.decebal.nl>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20222&group=comp.lang.tcl#20222

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.lang.tcl
Subject: Why do I get accolades
Date: Thu, 29 Sep 2022 00:00:15 +0200
Organization: Decebal Computing
Lines: 28
Message-ID: <87pmff6txs.fsf@munus.decebal.nl>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="319ef5d54972a0881b83ab84add50471";
logging-data="495601"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+DLApn2WLWAmcUvqZEwHfmsLcJSOxEZfU="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:9vcx5Z038vWJqekh0mlAzBtjbNY=
sha1:uD7OML1c0yGil0sOVrjpIVNAO1I=
 by: Cecil Westerhof - Wed, 28 Sep 2022 22:00 UTC

When I use:
puts [format "%s (%s)" ${package} ${blockingPckg}]

I get:
pyppmd (py7zr)

When I use:
lappend manual ${package}
puts ${manual}

I get:
pyppmd

But when I use:
lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
puts ${manual}

I get:
{pyppmd (py7zr)}

What could be happening here? I would expect:
pyppmd (py7zr)

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Re: Why do I get accolades

<87leq36ryp.fsf@munus.decebal.nl>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20223&group=comp.lang.tcl#20223

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Thu, 29 Sep 2022 00:42:54 +0200
Organization: Decebal Computing
Lines: 37
Message-ID: <87leq36ryp.fsf@munus.decebal.nl>
References: <87pmff6txs.fsf@munus.decebal.nl>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="319ef5d54972a0881b83ab84add50471";
logging-data="499708"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0H6lkDdDCqYGOVpqB0tsnUOwuKWT+LZY="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:v5/+HiJlEKZ2YC1Vsz99/DLypa4=
sha1:AAwYeS7Nn8ijSHpROoApSreA880=
 by: Cecil Westerhof - Wed, 28 Sep 2022 22:42 UTC

Cecil Westerhof <Cecil@decebal.nl> writes:

> When I use:
> puts [format "%s (%s)" ${package} ${blockingPckg}]
>
> I get:
> pyppmd (py7zr)
>
> When I use:
> lappend manual ${package}
> puts ${manual}
>
> I get:
> pyppmd
>
> But when I use:
> lappend manual [format "%s (%s)" ${package} ${blockingPckg}]

It works when I use:
append manual [format "%s (%s) " ${package} ${blockingPckg}]

But I am still interested in what is happening.

> puts ${manual}
>
> I get:
> {pyppmd (py7zr)}
>
>
> What could be happening here? I would expect:
> pyppmd (py7zr)

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Re: Why do I get accolades

<th2pn7$rau$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20225&group=comp.lang.tcl#20225

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!a5rWVvs5S5ZXUwkNcVnRMw.user.46.165.242.91.POSTED!not-for-mail
From: saitology9@gmail.com (saitology9)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Wed, 28 Sep 2022 20:43:18 -0400
Organization: Aioe.org NNTP Server
Message-ID: <th2pn7$rau$1@gioia.aioe.org>
References: <87pmff6txs.fsf@munus.decebal.nl>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="27998"; posting-host="a5rWVvs5S5ZXUwkNcVnRMw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.1.2
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: saitology9 - Thu, 29 Sep 2022 00:43 UTC

On 9/28/22 6:00 PM, Cecil Westerhof wrote:
> When I use:
> puts [format "%s (%s)" ${package} ${blockingPckg}]
>
> I get:
> pyppmd (py7zr)
>
> When I use:
> lappend manual ${package}
> puts ${manual}
>
> I get:
> pyppmd
>
> But when I use:
> lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
> puts ${manual}
>
> I get:
> {pyppmd (py7zr)}
>
>
> What could be happening here? I would expect:
> pyppmd (py7zr)
>

It is because of the space: Your manual variable is a list, which
contains an element with characters that require special handling in
Tcl, which here happens to be the space character. Space is also the
default delimiter that [puts] uses when printing lists. In this case,
it would cause a confusion as to whether what it printed was two
separate elements, or a single element with spaces in it.

Try eliminating the space by using "%s(%s)" as the format or try using
[join $manual] before printing it.

Re: Why do I get accolades

<th2pri$rau$2@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20226&group=comp.lang.tcl#20226

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!a5rWVvs5S5ZXUwkNcVnRMw.user.46.165.242.91.POSTED!not-for-mail
From: saitology9@gmail.com (saitology9)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Wed, 28 Sep 2022 20:45:37 -0400
Organization: Aioe.org NNTP Server
Message-ID: <th2pri$rau$2@gioia.aioe.org>
References: <87pmff6txs.fsf@munus.decebal.nl>
<87leq36ryp.fsf@munus.decebal.nl>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="27998"; posting-host="a5rWVvs5S5ZXUwkNcVnRMw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.1.2
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: saitology9 - Thu, 29 Sep 2022 00:45 UTC

On 9/28/22 6:42 PM, Cecil Westerhof wrote:
>>
>> But when I use:
>> lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
>
> It works when I use:
> append manual [format "%s (%s) " ${package} ${blockingPckg}]
>
> But I am still interested in what is happening.
>
>

[lappend] and [append] are two very different commands, operating on
lists vs. strings. Hopefully my previous message explained the why here.

Re: Why do I get accolades

<th2tj4$io31$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20228&group=comp.lang.tcl#20228

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Thu, 29 Sep 2022 01:49:24 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <th2tj4$io31$1@dont-email.me>
References: <87pmff6txs.fsf@munus.decebal.nl>
Injection-Date: Thu, 29 Sep 2022 01:49:24 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="cdaebb8e8e31069bae87eb7c90ca0cfb";
logging-data="614497"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/69eu/bj1kfhUA+PzzQfZa"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:SbRM9VCnArAg1gWUP9T/RsvUfjc=
 by: Rich - Thu, 29 Sep 2022 01:49 UTC

Cecil Westerhof <Cecil@decebal.nl> wrote:
> But when I use:
> lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
> puts ${manual}
>
> I get:
> {pyppmd (py7zr)}
>
>
> What could be happening here? I would expect:
> pyppmd (py7zr)

Not from Tcl you shouldn't.

When you "puts" a list, Tcl outputs a string encoded such that it can
be converted back into the same list structure again later.

The { and } appear because space is normally a list element separator,
but when the separator appears in the value of an element, it is
'escaped' by surrounding the value with { }.

It is the same reasoning as to why CSV elements, themselves containing
commas as data, get surrounded by double quote characters.

Note this part of the 'list' manpage description:

Braces and backslashes get added as necessary, so that the
lindex command may be used on the result to re-extract the
original arguments, ...

Re: Why do I get accolades

<th3fiv$jvfl$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20232&group=comp.lang.tcl#20232

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: wortkarg3@yahoo.com (Harald Oehlmann)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Thu, 29 Sep 2022 08:56:31 +0200
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <th3fiv$jvfl$1@dont-email.me>
References: <87pmff6txs.fsf@munus.decebal.nl>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 29 Sep 2022 06:56:31 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a8ee150c22a36944ad2119c6efb08a42";
logging-data="654837"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+KbGcrtx7MUuJKXdVX8N/s"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.3.0
Cancel-Lock: sha1:WsAyZ1rced+naib5AMVS7Nu4iKU=
In-Reply-To: <87pmff6txs.fsf@munus.decebal.nl>
Content-Language: en-GB
 by: Harald Oehlmann - Thu, 29 Sep 2022 06:56 UTC

Am 29.09.2022 um 00:00 schrieb Cecil Westerhof:
> When I use:
> puts [format "%s (%s)" ${package} ${blockingPckg}]
>
> I get:
> pyppmd (py7zr)
>
> When I use:
> lappend manual ${package}
> puts ${manual}
>
> I get:
> pyppmd
>
> But when I use:
> lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
> puts ${manual}
>
> I get:
> {pyppmd (py7zr)}

lappend is a list append and transforms each parameter to a valid list
element. As the string contains a space, curly braces aree added.
To make it simpler, you may write:
lappend manual "pyppmd (py7zr)"

Re: Why do I get accolades

<87czbe7eip.fsf@munus.decebal.nl>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20234&group=comp.lang.tcl#20234

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Thu, 29 Sep 2022 10:47:58 +0200
Organization: Decebal Computing
Lines: 30
Message-ID: <87czbe7eip.fsf@munus.decebal.nl>
References: <87pmff6txs.fsf@munus.decebal.nl> <th3fiv$jvfl$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="319ef5d54972a0881b83ab84add50471";
logging-data="674178"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HvfmBCsAGrXPqXgUAaaoAWHqa1AE/vz4="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:ASj9DEXvO/35HUcqxRovJFsDXW0=
sha1:w5AAq9GTZf9y7xbvkjtC4vmw/mk=
 by: Cecil Westerhof - Thu, 29 Sep 2022 08:47 UTC

Harald Oehlmann <wortkarg3@yahoo.com> writes:

> Am 29.09.2022 um 00:00 schrieb Cecil Westerhof:
>> When I use:
>> puts [format "%s (%s)" ${package} ${blockingPckg}]
>> I get:
>> pyppmd (py7zr)
>> When I use:
>> lappend manual ${package}
>> puts ${manual}
>> I get:
>> pyppmd
>> But when I use:
>> lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
>> puts ${manual}
>> I get:
>> {pyppmd (py7zr)}
>
> lappend is a list append and transforms each parameter to a valid list
> element. As the string contains a space, curly braces aree added.
> To make it simpler, you may write:
> lappend manual "pyppmd (py7zr)"

I do not think that that will work, because the format is giving that
string.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Re: Why do I get accolades

<878rm27e3t.fsf@munus.decebal.nl>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20235&group=comp.lang.tcl#20235

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Thu, 29 Sep 2022 10:56:54 +0200
Organization: Decebal Computing
Lines: 11
Message-ID: <878rm27e3t.fsf@munus.decebal.nl>
References: <87pmff6txs.fsf@munus.decebal.nl>
<87leq36ryp.fsf@munus.decebal.nl>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="319ef5d54972a0881b83ab84add50471";
logging-data="674178"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Jr84yNm+6TKQCZaa2Gu2x449lWCUdea8="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:luN6USy/DmhTnXCP20bGSVp/6nY=
sha1:HaNOxpFtcVUSpjoCfI0AJi86ia8=
 by: Cecil Westerhof - Thu, 29 Sep 2022 08:56 UTC

Cecil Westerhof <Cecil@decebal.nl> writes:

> append manual [format "%s (%s) " ${package} ${blockingPckg}]

And I make thing needlessly difficult again. I should just use:
append manual "${package} (${blockingPackage}) "

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Re: Why do I get accolades

<87h70q7elz.fsf@munus.decebal.nl>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20236&group=comp.lang.tcl#20236

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Thu, 29 Sep 2022 10:46:00 +0200
Organization: Decebal Computing
Lines: 48
Message-ID: <87h70q7elz.fsf@munus.decebal.nl>
References: <87pmff6txs.fsf@munus.decebal.nl> <th2pn7$rau$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="319ef5d54972a0881b83ab84add50471";
logging-data="674178"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/w/ctJlWnGQ7wtwkCXzL9UNBwaSoDo1pI="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:n6AV9vBPjNGgZ0Ax63HASl2LjSY=
sha1:vUFGBsvRsepGauBoamrytuY0N2g=
 by: Cecil Westerhof - Thu, 29 Sep 2022 08:46 UTC

saitology9 <saitology9@gmail.com> writes:

> On 9/28/22 6:00 PM, Cecil Westerhof wrote:
>> When I use:
>> puts [format "%s (%s)" ${package} ${blockingPckg}]
>> I get:
>> pyppmd (py7zr)
>> When I use:
>> lappend manual ${package}
>> puts ${manual}
>> I get:
>> pyppmd
>> But when I use:
>> lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
>> puts ${manual}
>> I get:
>> {pyppmd (py7zr)}
>>
>> What could be happening here? I would expect:
>> pyppmd (py7zr)
>>
>
> It is because of the space: Your manual variable is a list, which
> contains an element with characters that require special handling in
> Tcl, which here happens to be the space character. Space is also the
> default delimiter that [puts] uses when printing lists. In this case,
> it would cause a confusion as to whether what it printed was two
> separate elements, or a single element with spaces in it.
>
> Try eliminating the space by using "%s(%s)" as the format or try using
> [join $manual] before printing it.

I use tclsh not enough. I should have know this. :'-(

First I only saved the package name, now I add the blocking package. I
should have used append instead of lappend from day one, but in the
original case the result was the same. So it did not have
consequences.
But it was still a bug in my opinion: I needed a string, so no reason
to work with a list.

By the way I use a tclsh script to keep my python pip up to date. :-D

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Re: Why do I get accolades

<th432m$lg4p$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20238&group=comp.lang.tcl#20238

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Thu, 29 Sep 2022 12:29:10 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <th432m$lg4p$1@dont-email.me>
References: <87pmff6txs.fsf@munus.decebal.nl> <87leq36ryp.fsf@munus.decebal.nl> <878rm27e3t.fsf@munus.decebal.nl>
Injection-Date: Thu, 29 Sep 2022 12:29:10 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="cdaebb8e8e31069bae87eb7c90ca0cfb";
logging-data="704665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4dkTHJUQ492wg/AFYpgXJ"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:lGTR1WgxHuQsL4bfMZkqVekggD0=
 by: Rich - Thu, 29 Sep 2022 12:29 UTC

Cecil Westerhof <Cecil@decebal.nl> wrote:
> Cecil Westerhof <Cecil@decebal.nl> writes:
>
>> append manual [format "%s (%s) " ${package} ${blockingPckg}]
>
> And I make thing needlessly difficult again. I should just use:
> append manual "${package} (${blockingPackage}) "

For plain strings, yes.

If you /want/ formatting (i.e. fixed width columns, or real's to a
specific decimal place, etc.) then of course use format.

Re: Why do I get accolades

<th43ch$lg4p$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20239&group=comp.lang.tcl#20239

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Thu, 29 Sep 2022 12:34:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <th43ch$lg4p$2@dont-email.me>
References: <87pmff6txs.fsf@munus.decebal.nl> <th2pn7$rau$1@gioia.aioe.org> <87h70q7elz.fsf@munus.decebal.nl>
Injection-Date: Thu, 29 Sep 2022 12:34:25 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="cdaebb8e8e31069bae87eb7c90ca0cfb";
logging-data="704665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yQb14ObBOOyPcWzNxthAu"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:yKzG6bSmk732zoxC7rAkqzMeccE=
 by: Rich - Thu, 29 Sep 2022 12:34 UTC

Cecil Westerhof <Cecil@decebal.nl> wrote:
> I use tclsh not enough. I should have know this. :'-(
>
> First I only saved the package name, now I add the blocking package.
> I should have used append instead of lappend from day one, but in the
> original case the result was the same. So it did not have
> consequences.

> But it was still a bug in my opinion: I needed a string, so no reason
> to work with a list.

Yes, and it is a "latent, hiding, data dependent bug". Using 'lists'
when you really want a plain string can most often seem to work fine,
because the basic, unescaped, string rep often looks identical to just
a plain string.

Then, months or years later, your code consumes a data value containing
a list 'meta-character' and the list escaping code does what you asked,
and escapes the string representation of the list values, and you have
either weird data being produced, or you have an actual exception error
situation.

It is in general best to never use list operators on plain strings, and
to never use string operators on lists. It is possible to do so
safely, but doing so is an 'advanced technique' and the programmer has
to fully understand the ramifications of what they are asking the
runtime to perform.

Re: Why do I get accolades

<th43pk$lg4p$3@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20240&group=comp.lang.tcl#20240

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Why do I get accolades
Date: Thu, 29 Sep 2022 12:41:24 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <th43pk$lg4p$3@dont-email.me>
References: <87pmff6txs.fsf@munus.decebal.nl> <th3fiv$jvfl$1@dont-email.me> <87czbe7eip.fsf@munus.decebal.nl>
Injection-Date: Thu, 29 Sep 2022 12:41:24 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="cdaebb8e8e31069bae87eb7c90ca0cfb";
logging-data="704665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mF21WKgDMx9ywAYloSnyq"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:95dXbZR0acvakAOU/W6l4pmTC7E=
 by: Rich - Thu, 29 Sep 2022 12:41 UTC

Cecil Westerhof <Cecil@decebal.nl> wrote:
> Harald Oehlmann <wortkarg3@yahoo.com> writes:
>
>> Am 29.09.2022 um 00:00 schrieb Cecil Westerhof:
>>> When I use:
>>> puts [format "%s (%s)" ${package} ${blockingPckg}]
>>> I get:
>>> pyppmd (py7zr)
>>> When I use:
>>> lappend manual ${package}
>>> puts ${manual}
>>> I get:
>>> pyppmd
>>> But when I use:
>>> lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
>>> puts ${manual}
>>> I get:
>>> {pyppmd (py7zr)}
>>
>> lappend is a list append and transforms each parameter to a valid list
>> element. As the string contains a space, curly braces aree added.
>> To make it simpler, you may write:
>> lappend manual "pyppmd (py7zr)"
>
> I do not think that that will work, because the format is giving that
> string.

Harald's version will produce the same output as your format:

$ rlwrap tclsh
% lappend manual "pyppmd (py7zr)"
{pyppmd (py7zr)}
% puts $manual
{pyppmd (py7zr)}
%

You get the curly braces because of the space inside element zero, not
because you used format to generate the string that became element
zero's content.


devel / comp.lang.tcl / Why do I get accolades

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor