* Re: Bug#526924: zparseopts: should use lists as values in assoc array
[not found] <20090504130124.GA13947@piper.oerlikon.madduck.net>
@ 2009-05-05 16:05 ` Clint Adams
2009-05-05 16:36 ` martin f krafft
2009-05-05 17:05 ` Bart Schaefer
0 siblings, 2 replies; 4+ messages in thread
From: Clint Adams @ 2009-05-05 16:05 UTC (permalink / raw)
To: martin f krafft, 526924; +Cc: zsh-workers
On Mon, May 04, 2009 at 03:01:24PM +0200, martin f krafft wrote:
> piper:~|master|% set -- -a1 -a2; zparseopts -A arr a+:; echo $arr[-a]
> 12
>
> Unfortunately, this greatly reduces the usefulness of the builtin,
> since it's impossible to tell from the hash value whether the
> options where -a1 -a2 or -a12.
>
> It would be better if the value pointed to by the hash would contain
> a list, such that $arr[-a] in the above would be (1 2).
Unfortunately we don't handle arrays as values of associate arrays
(yet?) but you can do something like
set -- -a1 -a2; zparseopts 'a+:=arr'; print -l $arr
although this seems to set arr=(1 -a 2), which is not what I
expected to happen.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug#526924: zparseopts: should use lists as values in assoc array
2009-05-05 16:05 ` Bug#526924: zparseopts: should use lists as values in assoc array Clint Adams
@ 2009-05-05 16:36 ` martin f krafft
2009-05-05 17:05 ` Bart Schaefer
1 sibling, 0 replies; 4+ messages in thread
From: martin f krafft @ 2009-05-05 16:36 UTC (permalink / raw)
To: 526924, zsh-workers
[-- Attachment #1: Type: text/plain, Size: 876 bytes --]
also sprach Clint Adams <schizo@debian.org> [2009.05.05.1805 +0200]:
> Unfortunately we don't handle arrays as values of associate arrays
> (yet?) but you can do something like
Aha.
pulse:~|master|% declare -A foo; foo[Clint]=(1 2 3)
zsh: foo: attempt to set slice of associative array
:(
> set -- -a1 -a2; zparseopts 'a+:=arr'; print -l $arr
>
> although this seems to set arr=(1 -a 2), which is not what I
> expected to happen.
Yeah, that's a bit weird, isn't it? Should I clone the bug?
As for the original bug, maybe just insering $IFS[0] between
elements would do?
--
.''`. martin f. krafft <madduck@d.o> Related projects:
: :' : proud Debian developer http://debiansystem.info
`. `'` http://people.debian.org/~madduck http://vcs-pkg.org
`- Debian - when you have better things to do than fixing systems
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug#526924: zparseopts: should use lists as values in assoc array
2009-05-05 16:05 ` Bug#526924: zparseopts: should use lists as values in assoc array Clint Adams
2009-05-05 16:36 ` martin f krafft
@ 2009-05-05 17:05 ` Bart Schaefer
2009-05-05 17:28 ` martin f krafft
1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2009-05-05 17:05 UTC (permalink / raw)
To: Clint Adams, martin f krafft, 526924; +Cc: zsh-workers
On May 5, 4:05pm, Clint Adams wrote:
}
} set -- -a1 -a2; zparseopts 'a+:=arr'; print -l $arr
}
} although this seems to set arr=(1 -a 2), which is not what I
} expected to happen.
The parameter is set to (-a 1 -a 2), but "print -l $arr" is consuming
the first -a as an option to print.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug#526924: zparseopts: should use lists as values in assoc array
2009-05-05 17:05 ` Bart Schaefer
@ 2009-05-05 17:28 ` martin f krafft
0 siblings, 0 replies; 4+ messages in thread
From: martin f krafft @ 2009-05-05 17:28 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Clint Adams, 526924, zsh-workers
[-- Attachment #1: Type: text/plain, Size: 829 bytes --]
retitle 526924 zparseopts: separate options in
also sprach Bart Schaefer <schaefer@brasslantern.com> [2009.05.05.1905 +0200]:
> The parameter is set to (-a 1 -a 2), but "print -l $arr" is consuming
> the first -a as an option to print.
Confirmed. This leaves the question of whether something could be
used to separated the values in the case of
set -- -a1 -a2; zparseopts -A arr a+:-; print -- $arr[-a]
--
.''`. martin f. krafft <madduck@d.o> Related projects:
: :' : proud Debian developer http://debiansystem.info
`. `'` http://people.debian.org/~madduck http://vcs-pkg.org
`- Debian - when you have better things to do than fixing systems
"sometimes the urge to do bad is nearly overpowering"
-- ben horne
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-05 17:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20090504130124.GA13947@piper.oerlikon.madduck.net>
2009-05-05 16:05 ` Bug#526924: zparseopts: should use lists as values in assoc array Clint Adams
2009-05-05 16:36 ` martin f krafft
2009-05-05 17:05 ` Bart Schaefer
2009-05-05 17:28 ` martin f krafft
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).