From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29659 invoked by alias); 12 Dec 2016 16:41:48 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40164 Received: (qmail 14528 invoked from network); 12 Dec 2016 16:41:48 -0000 X-Qmail-Scanner-Diagnostics: from mailout3.w1.samsung.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(210.118.77.13):SA:0(-8.0/5.0):. Processed in 2.744467 secs); 12 Dec 2016 16:41:48 -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=-8.0 required=5.0 tests=RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at samsung.com does not designate permitted sender hosts) X-AuditID: cbfec7f5-f79ce6d000004c54-7e-584ed0e0d61b Date: Mon, 12 Dec 2016 16:31:24 +0000 From: Peter Stephenson To: Zsh hackers list Subject: Re: PATH: autoload with explicit path Message-id: <20161212163124.6654f077@pwslap01u.europe.root.pri> In-reply-to: <161212080550.ZM935@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDIsWRmVeSWpSXmKPExsWy7djPc7oPLvhFGHTt47c42PyQyYHRY9XB D0wBjFFcNimpOZllqUX6dglcGXvm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BzdpB+FgFViSWHNoHZbAKGElM3zWYE sUUEtCR2nDzJBGILC+hJ/Pj6gQXE5hWwl9i3rY0NxOYUsJDo7DjBCjF0C6NE+4GDYM38AvoS V/9+YoI40F5i5pUzjBDNghI/Jt8DG8QMtGDztiZWCFteYvOat8wgtpCAusSNu7vZJzAKz0LS MgtJyywkLQsYmVcxiqSWFuem5xYb6RUn5haX5qXrJefnbmIERtK2Yz+37GDsehd8iFGAg1GJ h1dgk1+EEGtiWXFl7iFGCQ5mJRFekbNAId6UxMqq1KL8+KLSnNTiQ4ymwJCZyCwlmpwPjPK8 knhDE0NzS0MjYwsLcyMjJXHeqR+uhAsJpCeWpGanphakFsH0MXFwSjUwHjo+OcPDofL+/Y3R ITN+H0lXfG20S03Mr/vlzGN6rTbOovJuB25N+La5vWn7dL3V54o3sod9evelP+StrOL+9Xsb p0/b3T/14IWj/mdL7hnLXg85zqPqIvh2yhL/cOnPx2ILOjMTvv48ssNqzTSxLLGeo+ZfHXd1 d+hb7r5W85Hv1lXrfLm8AiWW4oxEQy3mouJEAGBR3jO6AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161212163127eucas1p24e7efc6367ab32f2dfa7e35157dc0f5c X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?UGV0ZXIgU3RlcGhlbnNvbhtTQ1NDLURhdGEgUGxhbmUb?= =?UTF-8?B?7IK87ISx7KCE7J6QG1ByaW5jaXBhbCBFbmdpbmVlciwgU29mdHdhcmU=?= X-Global-Sender: =?UTF-8?B?UGV0ZXIgU3RlcGhlbnNvbhtTQ1NDLURhdGEgUGxhbmUbU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtQcmluY2lwYWwgRW5naW5lZXIsIFNvZnR3YXJl?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDA1Q0QwNTAwNTg=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161212160617epcas2p16960e3d95c694147035f760090e6011b X-RootMTR: 20161212160617epcas2p16960e3d95c694147035f760090e6011b References: <20161211221844.5e51affe@ntlworld.com> <161212080550.ZM935@torch.brasslantern.com> On Mon, 12 Dec 2016 08:05:50 -0800 Bart Schaefer wrote: > If I understand what you're saying, that means > > autoload this/here/file > > creates a function named "this/here/file" by loading "file" from > $^fpath/this/here ... yes? > > And then (before this patch) > > autoload /this/here/file > > creates a function named "/this/here/file" from the same location? > > So after this patch there is no way to autoload a function whose name > begins with a slash. Not that it was especially useful to be able to > do so, just confirming. Yes, that all looks like it's correct. > If I may make a suggestion -- an equally useful variation would be for > autoload to search the $fpath at the time of the autoload command and > store the path where the file is found *iff* it is found. This would > be sort of like doing > > autoload -Uz $^fpath/myfunc(N) > > except that it handles the situation where $fpath does not yet contain > the "myfunc" file. > > Another useful variation might be to fall back to the current fpath if > the function isn't found at the specified location. These need some form of new syntax, but it looks like options are probably good enough. -r for remember the path where found (or -s for save/store?) and -c for use current fpath as default (or -d for default? anything with -f or -p being a bit vague in this context). -R for remember and also ensure it's there with a hard error if it isn't there would be possible if it seems useful --- it gives you a way you don't currently have of expressing the fact the function is required and you might as well bomb out immediately rather than once you're committed to doing whatever. Presumably -c should remember the path, even if it found it on $fpath rather than the specified location, to avoid surprises. We're at the point where autoload isn't really a synonym of functions -u any more. I'd be tempted to document "functions -u" as "implements a limited subset of..." rather than "equivalent to...". (Does anyone use that interface except for compatibility?) pws