zsh-users
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <larryv@zsh.org>
To: "Ray Andrews" <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: uninvited members of associative array
Date: Thu, 15 Dec 2022 20:29:03 -0500	[thread overview]
Message-ID: <fcaa443c-8896-4758-8792-9168a23335cd@app.fastmail.com> (raw)
In-Reply-To: <0c2b1f8f-35bb-cd52-3d22-0964a73945b2@eastlink.ca>

On Thu, Dec 15, 2022, at 7:48 PM, Ray Andrews wrote:
> On 2022-12-15 16:05, Lawrence Velázquez wrote:
>> How are you creating and populating "main"? Can you provide a test
>> case that the rest of us can actually use?
>
> There's always the chance it doesn't even come to that, some artifact in 
> the way the array prints or something.

It makes no sense to question the code before verifying that your
data isn't garbage.


> But if you need to see an 
> initialization:
>
>
> # nlist(): Initialize 'main' array.  10 elements: 
> -----------------------------
> main[window]="main"
> main[list]='List'
> main[lastE]="$#List"
> main[hight]=$(( mainWH - 2 ))
> main[width]=$(( mainWW - 2 ))
> main[bottomE]="$main[hight]"
> main[topE]=1
> main[currentE]=1
> main[offset]=0
> main[active]=1

Still a bad test case because it depends on a bunch of other variables
that we have to guess about.  I don't understand why you can't provide
something self-contained.

Is that really all that's in "main"?  What does "typeset -p main"
say?


> ... all values assign properly, so where do the uninvited keywords come 
> from?

Still not seeing a problem.

	% cat foo.zsh
	typeset -A main

	main[window]=main
	main[list]=List
	main[lastE]=196
	main[height]=48
	main[width]=90
	main[bottomE]="$main[height]"
	main[topE]=1
	main[currentE]=1
	main[offset]=0
	main[active]=1

	typeset -p main

	printf '%-20s %s\n' ${(kv)main}

	% zsh foo.zsh
	typeset -A main=( [active]=1 [bottomE]=48 [currentE]=1 [height]=48 [lastE]=196 [list]=List [offset]=0 [topE]=1 [width]=90 [window]=main )
	width                90
	window               main
	offset               0
	topE                 1
	height               48
	active               1
	bottomE              48
	lastE                196
	list                 List
	currentE             1

-- 
vq


  reply	other threads:[~2022-12-16  1:31 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 23:48 Ray Andrews
2022-12-16  0:05 ` Lawrence Velázquez
2022-12-16  0:48   ` Ray Andrews
2022-12-16  1:29     ` Lawrence Velázquez [this message]
2022-12-16  2:09     ` Dominik Vogt
2022-12-16  2:56       ` Ray Andrews
2022-12-16  3:21         ` Lawrence Velázquez
2022-12-16  4:16           ` Ray Andrews
2022-12-16 10:05             ` Dominik Vogt
2022-12-16 14:13               ` Ray Andrews
2022-12-16 15:19                 ` Dominik Vogt
2022-12-16 19:14                   ` Ray Andrews
2022-12-16 16:30                 ` Daniel Shahaf
2022-12-16 18:21                   ` Ray Andrews
2022-12-16 19:04                     ` Dominik Vogt
2022-12-16 20:10                       ` Ray Andrews
2022-12-16 21:15                         ` Dominik Vogt
2022-12-16 21:33                           ` Bart Schaefer
2022-12-16 21:59                             ` Dominik Vogt
2022-12-16 22:15                               ` Bart Schaefer
2022-12-16 23:33                                 ` Ray Andrews
2022-12-17 12:47                                   ` Pier Paolo Grassi
2022-12-17 17:32                                     ` Ray Andrews
2022-12-17 18:10                                 ` Ray Andrews
2022-12-17 18:19                                   ` Roman Perepelitsa
2022-12-17 20:31                                     ` Ray Andrews
2022-12-17 20:49                                       ` Bart Schaefer
2022-12-17 21:07                                       ` Lawrence Velázquez
2022-12-17 21:52                                         ` Ray Andrews
2022-12-17 22:10                                           ` Bart Schaefer
2022-12-17 23:41                                             ` Daniel Shahaf
2022-12-18  0:15                                             ` Ray Andrews
2022-12-18  0:25                                               ` Daniel Shahaf
2022-12-18  2:13                                                 ` Ray Andrews
2022-12-18 20:12                                                   ` Daniel Shahaf
2022-12-18 20:26                                                     ` Bart Schaefer
2022-12-18 20:41                                                       ` Ray Andrews
2022-12-18  3:44                                               ` Lawrence Velázquez
2022-12-17 23:25                                         ` Daniel Shahaf
2022-12-16 21:33                           ` Ray Andrews
2022-12-16 20:25                       ` Daniel Shahaf
2022-12-16 21:43                         ` Dominik Vogt
2022-12-16  3:20 ` Bart Schaefer
2022-12-16  4:15   ` Ray Andrews
2022-12-16  8:12 ` Roman Perepelitsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fcaa443c-8896-4758-8792-9168a23335cd@app.fastmail.com \
    --to=larryv@zsh.org \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).