From mboxrd@z Thu Jan 1 00:00:00 1970
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org
X-Spam-Level:
X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham
autolearn_force=no version=3.4.4
Received: (qmail 8831 invoked from network); 25 Oct 2022 18:37:10 -0000
Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368)
by inbox.vuxu.org with ESMTPUTF8; 25 Oct 2022 18:37:10 -0000
ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1666723030;
b=ifq12578bjcxidW1nolDn54f9geNTt6/OzTQokUwBdpBlhDs24GCve2Zc6PJbVTXNqzjsUFpUM
hoUDFBwzipHyM2OYt+n4x8VcttNFFnzIVJPPyhSJGJK+5e1XMpKu+69BoLmtTD1AU8YcvZOCCH
eBOmgzA9oSzGSgcLjR97u7Gy/9ocSoteHDKTXwiPYeF5Ef20uX2EFuxHDP7zuxhU5+QHtB5oc1
GbPKq0MjbiD/RO7BY/1r4Sc87zL5m9dGKgaIQZuZ69AnBPQz4CQI2WyedJ2iF/JyvpF7IJ4d99
uU8UuT109hz/7bqdNOrJPHp3LFsamBQKL5gLvJJMJbUEkQ==;
ARC-Authentication-Results: i=1; zsh.org;
iprev=pass (smtpq1.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.96;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1666723030;
bh=zVxGlbltGMOi8cOOv777uSQX7VDzV52AEbjfl1UsGHw=;
h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help:
List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Content-Type:
References:In-Reply-To:Date:To:From:Subject:Message-ID:DKIM-Signature:
DKIM-Signature;
b=F5jYjhegPSYk8yo4WAURWq+QS/0mS20IUE7mrrJh/vYRZm+43qz3Xs1P6y63bWKvhIanLalHPZ
cLq+tE9obaJpfCSGdJ2vrQVJAIcDkW14dr1xCJq2QQiSP+fmIYqa6KxstyN/yec2sQYMpwKk87
YTi/Yb7yJhET3QBL6FssyA8YKwbeyTZ3RyK71Nh1NghNq3+VZttiNDwFjMNb30wbbUVNf8Jy3D
+lkhMxpL68beFk6LtdLU99BzWpSzeERZFeqVLbJxsxp38FMnNJbnAvo8e0UIfupqvKbZiIMSCH
y84qAoVY5sB/g4Cxgx9ogFucbIaToYZq9cDMnHn1gT1B3w==;
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org;
s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:
List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding:
Mime-Version:Content-Type:References:In-Reply-To:Date:To:From:Subject:
Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From
:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
bh=uB/YnfkjZClOj8UF8PVBbYiup4N/V4T4/UJC58W93DE=; b=pL6LszVhbSoMej/3KlagKGHZC4
5tgMpFbxsAL1sV/ZbLEGqd9C4utTUjgIKK/CTAJyJ2vA7U1/LhvLr/IAharMEkE9djoc5OK0eM44J
hH6vtcbp4BDuO+GNpxOaFMHCMgD0vq7sONLikIi8USonbs285aFu1UWi+3TLrNalA3RrMqzP7BhrA
8ONGkMKXe8PdXNC8gTJBC2MGbrQfAUNuDLKYjr1gARgB+k/weLeAPmtrG/TxvteO9r9keCkSDIf8s
vl2p3K2SY5nDryZwQPAbZgaQZhTREGHMFC4B1ud33OtyJjJ7K4xhLPy3KVoUwoiH3bq9i7yhcWHgk
EO/HUZ5Q==;
Received: by zero.zsh.org with local
id 1onOnV-0004hg-FL;
Tue, 25 Oct 2022 18:37:09 +0000
Authentication-Results: zsh.org;
iprev=pass (smtpq1.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.96;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
Received: from smtpq1.tb.ukmail.iss.as9143.net ([212.54.57.96]:34278)
by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
id 1onOmo-0003zb-NK;
Tue, 25 Oct 2022 18:36:28 +0000
Received: from [212.54.57.112] (helo=csmtp8.tb.ukmail.iss.as9143.net)
by smtpq1.tb.ukmail.iss.as9143.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1)
(envelope-from
)
id 1onOmo-0000AH-B3
for zsh-users@zsh.org; Tue, 25 Oct 2022 20:36:26 +0200
Received: from pws-Zeus ([82.1.229.179])
by cmsmtp with ESMTPA
id nOmnoC85nTKgznOmooOSlQ; Tue, 25 Oct 2022 20:36:26 +0200
X-SourceIP: 82.1.229.179
X-Authenticated-Sender: p.w.stephenson@ntlworld.com
X-Spam: 0
X-Authority: v=2.4 cv=Q7XBXq6a c=1 sm=1 tr=0 ts=63582caa cx=a_exe
a=W4rGJ7PGCSRRUvufKHO8Dg==:117 a=W4rGJ7PGCSRRUvufKHO8Dg==:17
a=IkcTkHD0fZMA:10 a=Qawa6l4ZSaYA:10 a=Dvk3skb4O_KscT5oIlcA:9 a=QEXdDO2ut3YA:10
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com;
s=meg.feb2017; t=1666722986;
bh=uB/YnfkjZClOj8UF8PVBbYiup4N/V4T4/UJC58W93DE=;
h=Subject:From:To:Date:In-Reply-To:References;
b=VI7lqBXkFVYEcw9S1wj8XxOC8RXImWCbXZhUzX7UbAhMJwvVX7xGVsjl9cUmtnTgR
RLMfFprS66ZkDLSD8p2SSFPHoxyK1GY7VdsnUYjZI47Nr2WKDhkM4NtY/XQhg3WQwb
9HfyN1EdsS8NiZRC3VVq5bOqOTIN362MQMvfqKKle9Dya3NDXg1h6OChh9JbE+0/17
jPgeYnNVtnqYn8vVGvAvnePWW7NvZKhsf2RMwiGP+Q99O9S4rUPd3sY5bJi/RN+aWK
860e/rrqSsCR5BtESdiUUDR0JYbhXT1H/Kil0X6Ve7fa7CEvK+OFfNSDQ/UEgx+lbf
KCyaAOY6ashQw==
Message-ID:
Subject: Re: priority of execution
From: Peter Stephenson
To: zsh-users@zsh.org
Date: Tue, 25 Oct 2022 19:36:25 +0100
In-Reply-To:
References: <04b0ce6b-be24-66f0-44e6-0183280e19cf@eastlink.ca>
<54517317.3641240.1666714093628@mail.virginmedia.com>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-CMAE-Envelope: MS4xfFPES1uAkEiplf+LINlXCAvv/R9bxrkAHbNnvff7Inw0kMtRcu7Xj4472E/uzOAONxbmENSOa6wTAjpUEbD1pSijJZB2IrIm9p1BJa+vXmH/4nEMiSJl
QLkTCOj2J52tq7sL16BElCAbtUqbnipoUtn7ikNCZIgLZN7Vz2cV+cGb/6KNhiZiHq3mgrSrgOhK2Q==
X-Seq: 28269
Archived-At:
X-Loop: zsh-users@zsh.org
Errors-To: zsh-users-owner@zsh.org
Precedence: list
Precedence: bulk
Sender: zsh-users-request@zsh.org
X-no-archive: yes
List-Id:
List-Help: ,
List-Subscribe: ,
List-Unsubscribe: ,
List-Post:
List-Owner:
List-Archive:
On Tue, 2022-10-25 at 10:17 -0700, Ray Andrews wrote:
> On 2022-10-25 09:08, Peter Stephenson wrote:
> > The different categories known to whence, from looking at the source,
> > are aliases, reserved words, shell functions, builtins, and binaries
> > in the file system (in the case of whence, those found via $PATH).
>
> In that order?
Aliases are parsed while stuff is still being read in. This is why
they're the only type that allow you to use the name of the alias as
some other type of command.
Reserved words are handled after the line has been read in, but still
quite early in parsing, because, as I explained, they need to know about
the structure of what follows.
Everying else is only examined during execution (so if a function
contains the name of one of the following types, it won't be decided
until the function's run which sort it's using --- that's not true of
aliases and reserved words, their effect gets baked into the function).
Shell functions are looked for first. This means you can replace a
builtin or an external command with a function of the same name, and
still call e.g.
whence() { print This is a special whence; builtin whence "$@"; }
ls() { print Tthis is a special ls; command ls "$@"; }
Builtins are next, which means a builtin with the same name as an
external command is called in preference. This is usually useful as its
faster, e.g. "test", but sometimes an annoyance, e.g. "enable" is a
shell command but may be an external printer command. You can disable
builtins you don't need, or use a shell function workaround ("command"
always calls an external command in zsh, unlike other shells, unless
you're in compatibility mode).
External commands are last, with their own rules about the use of $PATH
or absolute paths or those relative to the current directory.
> > Autoloadable functions are a special category of function
>
> But whence reports them specially:
Yes, just to be helpful. You'll see once the function has been
autoloaded, it's just a normal function, and if you define a normal
function with that name the autoload flag just vanishes. It's
really ordering rather than precedence. If the function's already defined
it's not autoloadable, and it'll ignore attempts to make it so unless
you undefine it first. Autoloading is just an instruction about how to
get the function if it's not there, it's not really a type of function
at all.
pws