zsh-workers
 help / color / mirror / code / 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, other threads:[~2020-02-20  6:35 UTC | newest]

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

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).