zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: zsh 5.0.2-test-1 is available
Date: Sat, 9 Nov 2013 22:32:50 +0000	[thread overview]
Message-ID: <20131109223250.706e20fb@pws-pc.ntlworld.com> (raw)
In-Reply-To: <131108181143.ZM26121@torch.brasslantern.com>

On Fri, 08 Nov 2013 18:11:43 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Nov 8,  4:11pm, Peter Stephenson wrote:
> }
> } It seems to me it's equally not an error to mark zstat as a builtin from
> } zsh/stat if it's already loaded as a builtin from zsh/stat.  It would
> } only be an error if there's a conflict.
> } 
> } That's how "autoload" works, after all: it can't check for a conflict
> } (without major faff) but it does check if a function's already loaded.
> 
> 
> I'm confused; these statements seem contradictory, so I must be missing
> something.  If we can't check for a conflict, how can we suppress the
> error message?  I.e., how do we know that zstat is already loaded as a
> builtin from the same module we're now loading?

For functions, autoload (the builtin of that name) works this way,
suppressing an error message if a functiona already exists, but it can't
check for a conflict because it would have to scan the path, load the
file it found, and check that the loaded file compared the same as the
already loaded file.  This is as much work as deleting the file and
reloading it when "autoload" is encountered again.  So it silently
assumes if a function is loaded that it's the function you wanted.  I
was using this case as the paradigm of how an autoload of any sort
works, to point out that, when whatever-it-is is already loaded,
generating an error on a new autoload isn't necessarily the right thing to do.

For autoloads from modules, which may be builtins, conditions, math
functions or parameters, we can actually do a bit better, with a little
more work but nothing like to the same extent (no additional loading is
required).  Suppose we load builtin bar from zsh/foo at some point,
doesn't matter how, then run "zmodload -a bar zsh/foo".  We find that a
builtin bar exists.  We can then check that zsh/foo is already loaded,
and is already providing builtin bar.  It seems to me, based on the
argument from functions, that it would be entirely natural just to
ignore the zmodload -a as redundant rather than report it as an error;
and, furthermore, given that you can check by this means the effect really
*is* redundant rather than a conflict, it seems to me there is no
harmful side effect of any sort.  (Obviously, contradictory indications
are invited.)

I hope that's clear now.

I started looking at this on Friday but I need to be careful which
builtins flying around are which, so will get back to it at some point.

pws


      parent reply	other threads:[~2013-11-09 22:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 20:23 Peter Stephenson
2013-11-06 21:57 ` Phil Pennock
2013-11-07 15:33 ` Axel Beckert
2013-11-07 16:05   ` Peter Stephenson
2013-11-07 19:18     ` Phil Pennock
2013-11-08  1:36       ` Bart Schaefer
2013-11-08  3:16         ` Axel Beckert
2013-11-08  6:01           ` Bart Schaefer
2013-11-08  7:16         ` Phil Pennock
2013-11-08  9:38           ` Peter Stephenson
2013-11-08 14:39             ` Bart Schaefer
2013-11-08 16:11               ` Peter Stephenson
2013-11-09  2:11                 ` Bart Schaefer
2013-11-09  3:35                   ` John
2013-11-09  5:20                     ` Shawn Wilson
2013-11-09 22:32                   ` Peter Stephenson [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=20131109223250.706e20fb@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.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).