Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1069191

Bug#993388: [Pkg-tcltk-devel] Bug#993388: tcl8.6: nested dicts: with lappend you can duplicate and than remove intermediate values

From Sergei Golovan <sgolovan@gmail.com>
Newsgroups linux.debian.bugs.dist
Subject Bug#993388: [Pkg-tcltk-devel] Bug#993388: tcl8.6: nested dicts: with lappend you can duplicate and than remove intermediate values
Date 2021-08-31 18:40 +0200
Message-ID <CSeXM-65d-27@gated-at.bofh.it> (permalink)
References <CSeXM-65d-23@gated-at.bofh.it> <CSeXM-65d-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Davide,

As far as I can see, there's nothing wrong with Tcl here. You just
treat a list as a dict, hence the confusion. See this simpler example:

% set M {A B C D C {1 2}}
A B C D C {1 2}

Here, $M contains a list (actually, a string which can be interpreted
as a list). But we can try to interpret it as a dict:

% dict lappend M C 3
A B C {1 2 3}

Here, $M is reinterpreted as a dict, with odd items A, C, C as its
keys, and even items B, D, {1 2} as values. The problem is that there
is the duplicate key C, so Tcl had to drop one of its values (the last
one overwritten the first one upon creation of the dict). After that,
3 was appended to the list {1 2}.

Cheers!
-- 
Sergei Golovan

Back to linux.debian.bugs.dist | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Bug#993388: tcl8.6: nested dicts: with lappend you can duplicate and than remove intermediate values Davide Prina <Davide.Prina@gmail.com> - 2021-08-31 18:40 +0200
  Bug#993388: [Pkg-tcltk-devel] Bug#993388: tcl8.6: nested dicts: with lappend you can duplicate and than remove intermediate values Sergei Golovan <sgolovan@gmail.com> - 2021-08-31 18:40 +0200
    Bug#993388: [Pkg-tcltk-devel] Bug#993388: tcl8.6: nested dicts: with lappend you can duplicate and than remove intermediate values Davide Prina <davide.prina@gmail.com> - 2021-09-03 20:50 +0200

csiph-web