From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14932 invoked by alias); 20 Oct 2016 22:51:00 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22014 Received: (qmail 14237 invoked from network); 20 Oct 2016 22:51:00 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f42.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.213.42):SA:0(0.0/5.0):. Processed in 0.766749 secs); 20 Oct 2016 22:51:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=uHl+FwcPEcBKD6IZVO1Lc5BAL/FDxAyEZ4uFKoak6wY=; b=a7QHQeKXW5AQGWePrlXYJ8+qr44XXjANUjmy/ZZhESBOU1x/AB7WggHnNv5S5g3T9U jSrNaPK6cXOXAIQXUV0Hh4ZpFjwqsQeroMSSAt2YRsldRQVlKunmQgL27dREWnt5kB7a fygxsrizE0O+qh1b9/dz1xM7jYnsyT1Qq0MlaGQZYiHE7HloJDFmlCP7W7tLIdAn9DYR AIX74QiXKdPgqOe1Hj/NiDOk0lfIIAagjoEtydRn64H557ujbbYeyPDkPnsUnP8+ig7e e20C3ujTBh3+h518YPFl1RTwYTHbWxdZiJGXNp7lMV8VVxwAsV7iC5TCBti0rXqyHvXI wmjQ== X-Gm-Message-State: ABUngve0MkK4OuOX3QEKXP/fkWdYFKas2cxJsW3kXIhlkbXe9BrOwfDGqEKbT99wrXyung== X-Received: by 10.31.206.198 with SMTP id e189mr3621298vkg.51.1476997448180; Thu, 20 Oct 2016 14:04:08 -0700 (PDT) From: Bart Schaefer Message-Id: <161020140409.ZM5530@torch.brasslantern.com> Date: Thu, 20 Oct 2016 14:04:09 -0700 In-Reply-To: Comments: In reply to Filipe Silva "revisiting passing arrays to functions" (Oct 20, 5:32pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: revisiting passing arrays to functions MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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.