Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: revisiting passing arrays to functions
- X-seq: zsh-users 22014
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: revisiting passing arrays to functions
- Date: Thu, 20 Oct 2016 14:04:09 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=uHl+FwcPEcBKD6IZVO1Lc5BAL/FDxAyEZ4uFKoak6wY=; b=S4l13K9c85ViPCh0XIolVoMJwLaph5Gsc3lyaf//+FYbo+zojQHqKklgEwZ08ZPiao +S+0DIWE0zfrJzF7sm4OERFxKcbbGZiq/y+7zzB3xTUlND1g9FNvDAYH+v6JFItpJ7gt SwzNCLeBvNIN0w5XT42pOztX5FEfDOCj7Whp8oGzHbz1BkKM2vIzXH2fZQTJwxGHmcm+ pl8GJAwOA1jRXwe/odsjndWem6H7uLgmmwwiRsMiQp9Pwu57R/5sv0O2YUjIlqaZA11I 7QWjBnKE2jZiv/enLOuwRgxk2vwvZKP+fXG/DuH1j20/WZYJiww/WF2ZkDX7BUhGWCku tP8w==
- In-reply-to: <CAEwkUWNGOczWsnrK3e--wons-huOh9zTjzFi5WpJosK+S0GC2A@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAEwkUWNGOczWsnrK3e--wons-huOh9zTjzFi5WpJosK+S0GC2A@mail.gmail.com>
On Oct 20, 5:32pm, Filipe Silva wrote:
}
} I searched through the archives and found this message about passing arrays
} to functions: http://www.zsh.org/mla/users/2011/msg00967.html
}
} But that was in 2011. Is that changed? Do we have a way to pass zsh
} arrays to a zsh function in a comfortable way?
Please define "comfortable"? (I guess I should ask PWS that.)
The semantics of the (P) expansion flag have been improved, so that for
example in 5.2 it works more sensibly with nested substitutions and also
with associative arrays, which was practically impossible before.
However, there's been nothing done to enable, for example, passing an
array as a pointer, because shell functions do not have named/typed
argument call signatures. It's still necessary to pass the name of
the array in a positional parameter and then apply (P) to that, with
all the corresponding consequences around scoping of the name, e.g.,
possible clashes with locals declared in the function.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author