zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: priority of execution
Date: Tue, 25 Oct 2022 10:17:01 -0700	[thread overview]
Message-ID: <b2f61c77-2e50-0c87-b7bf-eefa9bed0f61@eastlink.ca> (raw)
In-Reply-To: <54517317.3641240.1666714093628@mail.virginmedia.com>


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?
> Autoloadable functions are a special category of function

But whence reports them specially:

$ whence -v zmv
zmv is an autoload shell function

... I'm just trying to extract as much information as whence can supply.

> --- the
> difference only comes into play once the shell has decided it's
> looking for a shell function, so it's hidden from top-level
> execution.
So when it comes to precedence would a 'normal' function and an 
autoload, if they shared the ... Ah! the can't share the same name 
because if you define a function with the same name as an autoload the 
former is ... how to say it ... overruled.  So that's no issue. But 
whence will report the difference very politely.
> The same goes for shell scripts as a special category of
> binaries found in the file system.  The shell sees the script is
> a binary in the path and tries to execute it just like anything
> else marked as executable.  Typically the OS knows how to deal
> specially with scripts, though the shell has this knowledge as
> a fallback.

So it would be first found, first executed?  Or will there be precedence 
rules?

>
>> $ whence -av declare
>> declare is a reserved word
>> declare is a shell builtin
> That second case is rather special; you wouldn't encounter it very
> often.  But people moan horribly if we break their special cases.

Too heavy for me, that's stuff than only happens in the engine room.

But I'd still say that this should be the output:

$ whence -v declare

declare is a shell builtin

... it might be naive but that's what would seem to be the ... hmmm ... 
if 'reserved word' really does have precedence then maybe that's what's 
got to show, and the fact that I want to see 'shell builtin' is too bad 
for me.  It's intuitive that whence is looking for commands of some 
sort, but maybe strictness is more important.  Nothing is simple.






  reply	other threads:[~2022-10-25 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25 15:47 Ray Andrews
2022-10-25 16:08 ` Peter Stephenson
2022-10-25 17:17   ` Ray Andrews [this message]
2022-10-25 18:36     ` Peter Stephenson
2022-10-25 21:58       ` Ray Andrews

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=b2f61c77-2e50-0c87-b7bf-eefa9bed0f61@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --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).