zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: revisiting passing arrays to functions
Date: Thu, 20 Oct 2016 14:04:09 -0700	[thread overview]
Message-ID: <161020140409.ZM5530@torch.brasslantern.com> (raw)
In-Reply-To: <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.


      reply	other threads:[~2016-10-20 22:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-20 19:32 Filipe Silva
2016-10-20 21:04 ` Bart Schaefer [this message]

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=161020140409.ZM5530@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).