zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@fysh.org>
To: schaefer@candle.brasslantern.com (Bart Schaefer)
Cc: zsh-workers@sunsite.auc.dk
Subject: Re: Parameter module, $functions, and autoloading
Date: Sun, 24 Oct 1999 22:13:30 +0100 (BST)	[thread overview]
Message-ID: <E11fUxG-0007vK-00@crucigera.fysh.org> (raw)
In-Reply-To: <991024055629.ZM1635@candle.brasslantern.com> from Bart Schaefer at "Oct 24, 1999  5:56:28 am"

Bart Schaefer wrote:
>An interesting solution to both problems occurred to me today:  Create a
>builtin "undefined" that works like the alias above.  That builtin could
>have access to the function name and argv independent of FUNCTION_ARGZERO, 
>and would simply perform the autoload and execute.  It could even take an
>option -U having the same meaning as "autoload -U".

Would be nice.  Autoloaded functions are already internally executed in
a manner pretty close to this; it's tempting to change autoload to just
define the function with a body consisting of a call to this builtin.

The only issue I see is, unfortunately, a biggie.  What happens if you
have a function defined like this, then the user defines "undefined"
as a shell function (taking precedence over the builtin) and then tries
to execute the supposedly-autoloaded function?  Also consider disabling
the builtin.  You'd need some special syntax, rather than just a command
name, to avoid this potential clash.

If you do go with a special syntax, I suggest that the syntax allow
an arbitrary command name, rather than just handling this one case of
autoloaded functions.  There may be other things in the future for which
we want non-overridable builtin command syntax.

>A more complicated solution involves a minor parsing rewrite:  Create a
>new reserved word "undefined".

We can't define any new reserved words and retain sh/ksh compatibility.
That's even worse than a builtin.

Oh, I suggest that the name "autoloaded" is clearer than "undefined",
if we do do any of this.  I never liked that bit of the `functions`
format: if a function is undefined, surely it doesn't exist at all,
and shouldn't be output.

-zefram


  reply	other threads:[~1999-10-24 21:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-24  5:56 Bart Schaefer
1999-10-24 21:13 ` Zefram [this message]
1999-10-24 22:51   ` Bart Schaefer

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=E11fUxG-0007vK-00@crucigera.fysh.org \
    --to=zefram@fysh.org \
    --cc=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).