zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@dcs.warwick.ac.uk>
To: roderick@argon.org (Roderick Schertler)
Cc: zsh-workers@math.gatech.edu (Z Shell workers mailing list)
Subject: Re: ksh autoloading
Date: Thu, 27 Mar 1997 19:11:12 +0000 (GMT)	[thread overview]
Message-ID: <6837.199703271911@stone.dcs.warwick.ac.uk> (raw)
In-Reply-To: <14594.859489039@eeyore.ibcinc.com> from "Roderick Schertler" at Mar 27, 97 01:57:19 pm

Roderick Schertler wrote:
>Well, of course, if the function is written knowing it could run under
>ksh or zsh then it can be made to work.  The problem is that a function
>which was written in ksh style will suddenly stop working (on first
>invocation).

That used to be the case for *all* ksh style functions.  With this
patch in place, the most common case by far -- a single function with
no initialisation code -- is handled properly.

>I don't see how the zsh behavior is superior, and I do see advantages to
>the ksh behavior.

With zsh, you can have a file that is used both as an autoloaded shell
function and as a shell script.  It also makes it impossible to have
an autoloaded shell function that, when successfully autoloaded, still
isn't defined.

>Consider a file which provides 3 tightly related functions and runs some
>initialization code.  I used such a think for directory stack handling
>in ksh, eg.  In ksh you link it to the 3 names.  In zsh you have to do
>some work.

OK, use the line

[[ -n "${ZSH_VERSION+set}" ]] && "$0" "$@"

instead of what I previously suggested.

>I wanted to be sure you knew you were breaking ksh compatibility.

We never had complete ksh compatibility anyway.  Perhaps we need an
option to behave exactly like ksh here, i.e., just source the file before
running the function.

I look on the patch as improving zsh compatibility.  It means that any
function written in the zsh style (except for the one perverse case of
a function that does nothing but redefine itself) will work as expected.

-zefram


  reply	other threads:[~1997-03-27 19:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-26 17:46 Zefram
1997-03-27 18:15 ` Roderick Schertler
1997-03-27 18:36   ` Zefram
1997-03-27 18:57     ` Roderick Schertler
1997-03-27 19:11       ` Zefram [this message]
1997-04-01  0:08 Zefram

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=6837.199703271911@stone.dcs.warwick.ac.uk \
    --to=zefram@dcs.warwick.ac.uk \
    --cc=roderick@argon.org \
    --cc=zsh-workers@math.gatech.edu \
    /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).