zsh-workers
 help / color / Atom feed
* When array append without parens doesn't work?
@ 2020-02-18 21:33 Sebastian Gniazdowski
  2020-02-18 21:45 ` Roman Perepelitsa
  2020-02-18 23:38 ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Sebastian Gniazdowski @ 2020-02-18 21:33 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

Hi,
I recall once reporting a problem to this list, to which Bart responded
with "you'll thank me later" about the correct array-append syntax, which
is arr+=( ... ), not arr+=.... I cannot find this message.

I've only found a report on IRC that's related, however, what's in it
appears to work fine: http://sprunge.us/sUNWBk

Can anyone provide an example of the "almost-works" property of the +=...
syntax?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zinit
Blog: http://zdharma.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: When array append without parens doesn't work?
  2020-02-18 21:33 When array append without parens doesn't work? Sebastian Gniazdowski
@ 2020-02-18 21:45 ` Roman Perepelitsa
  2020-02-18 23:35   ` Sebastian Gniazdowski
  2020-02-18 23:38 ` Bart Schaefer
  1 sibling, 1 reply; 5+ messages in thread
From: Roman Perepelitsa @ 2020-02-18 21:45 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh hackers list

On Tue, Feb 18, 2020 at 10:33 PM Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> Hi,
> I recall once reporting a problem to this list, to which Bart responded
> with "you'll thank me later" about the correct array-append syntax, which
> is arr+=( ... ), not arr+=.... I cannot find this message.

Code:

  () {
   emulate -L zsh -o ksh_arrays
    local -a x
    x+=a
    x+=b
    typeset -p x
  }

Output:

  typeset -a x=( ab )

Roman.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: When array append without parens doesn't work?
  2020-02-18 21:45 ` Roman Perepelitsa
@ 2020-02-18 23:35   ` Sebastian Gniazdowski
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Gniazdowski @ 2020-02-18 23:35 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 827 bytes --]

On Tue, 18 Feb 2020 at 22:45, Roman Perepelitsa <roman.perepelitsa@gmail.com>
wrote:

> On Tue, Feb 18, 2020 at 10:33 PM Sebastian Gniazdowski
> <sgniazdowski@gmail.com> wrote:
> >
> > Hi,
> > I recall once reporting a problem to this list, to which Bart responded
> > with "you'll thank me later" about the correct array-append syntax, which
> > is arr+=( ... ), not arr+=.... I cannot find this message.
>
> Code:
>
>   () {
>    emulate -L zsh -o ksh_arrays
>     local -a x
>     x+=a
>     x+=b
>     typeset -p x
>   }
>
> Output:
>
>   typeset -a x=( ab )
>
> Roman.
>

Thanks, however, I don't think that I was using ksharrays when I've
encountered problems with +=....
-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zinit
Blog: http://zdharma.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: When array append without parens doesn't work?
  2020-02-18 21:33 When array append without parens doesn't work? Sebastian Gniazdowski
  2020-02-18 21:45 ` Roman Perepelitsa
@ 2020-02-18 23:38 ` Bart Schaefer
  2020-02-20  6:35   ` Sebastian Gniazdowski
  1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2020-02-18 23:38 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh hackers list

On Tue, Feb 18, 2020 at 1:33 PM Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> Can anyone provide an example of the "almost-works" property of the +=...
> syntax?

% Src/zsh -f
% a1=(1 2 3)
% a2=(a b c)
% a1+=$a2
% print -rl $a1
1
2
3
a b c
%

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: When array append without parens doesn't work?
  2020-02-18 23:38 ` Bart Schaefer
@ 2020-02-20  6:35   ` Sebastian Gniazdowski
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Gniazdowski @ 2020-02-20  6:35 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

On Wed, 19 Feb 2020 at 00:39, Bart Schaefer <schaefer@brasslantern.com>
wrote:

> On Tue, Feb 18, 2020 at 1:33 PM Sebastian Gniazdowski
> <sgniazdowski@gmail.com> wrote:
> >
> > Can anyone provide an example of the "almost-works" property of the +=...
> > syntax?
>
> % Src/zsh -f
> % a1=(1 2 3)
> % a2=(a b c)
> % a1+=$a2
> % print -rl $a1
> 1
> 2
> 3
> a b c
> %
>

This has to be it – the problem that I've occurred back then, thanks!

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zinit
Blog: http://zdharma.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18 21:33 When array append without parens doesn't work? Sebastian Gniazdowski
2020-02-18 21:45 ` Roman Perepelitsa
2020-02-18 23:35   ` Sebastian Gniazdowski
2020-02-18 23:38 ` Bart Schaefer
2020-02-20  6:35   ` Sebastian Gniazdowski

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git