zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh workers <zsh-workers@zsh.org>
Subject: Re: autoload -X inside an anonymous function
Date: Sat, 06 Oct 2012 00:56:31 -0700	[thread overview]
Message-ID: <121006005631.ZM936@torch.brasslantern.com> (raw)
In-Reply-To: <20121005223228.408a7b2f@pws-pc.ntlworld.com>

On Oct 5, 10:32pm, Peter Stephenson wrote:
}
} However, this opens a can of worms, or reveals an open can of worms, or
} at least perturbs the wave function of the universe sufficiently that
} measurement reveals the can of worms to be in the opened state.  (I can,
} however, understand that Schroedinger's Cat is likely to remain more
} popular than Stephenson's Wormcan.)  Sorry, it's Friday evening.

Apparently it's now possible to determine that there are in fact worms
in the can, even if you haven't opened it, which seems a much better
metaphor for what actually goes on in quantum superposition than does
a zombie cat.  It's evidently also possible for two events to be each
other's causes, which is something the zsh code base seems to be quite
suited to demonstrate.
 
}   emulate zsh -c 'autoload +X -z stuff'
} 
} does work, because the function is loaded while the emulation is still
} in effect.  More explicitly, the emulate in this case is only "sticky"
} for functions declared in it, not for functions marked for autoload in
} it.  Maybe this needs to change?

I hadn't followed before that you had to explicitly make this not be the
case:

} 	    /* No sticky emulation for autoloaded functions */
} 	    shf->emulation = 0;

I'm generally in favor of your patch from 30718.  I'm mildly concerned
about functions that, when executed, define or autoload other functions,
but even if that's a real issue it could be fixed by another emulate -c
scope.
 
} Beyond that, I'm not sure what the answer is; is making -z force zsh
} emulation reasonable?  I don't necessarily think making -k force ksh
} emulation is reasonable, the function might be a zsh function that just
} happens to be written using the ksh format for autoloads.

I think changing the semantics of autoload -z is probably going too far.
A new option to autoload that caused emulation to be in effect would be
OK, but as the effect can already be had with an emulate wrapper, that
might be unnecessary TMTOWTDI.

} This generalises in a natural way to other emulations in a way
} overloading the -z flag doesn't.

Agree.


      parent reply	other threads:[~2012-10-06  7:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18  2:12 Oliver Kiddle
2012-09-18 16:58 ` Bart Schaefer
2012-09-19  0:35   ` Bart Schaefer
2012-09-19  2:28   ` Oliver Kiddle
2012-09-19 14:58     ` Bart Schaefer
2012-09-20 19:35       ` Peter Stephenson
2012-09-24 18:50         ` Bart Schaefer
2012-10-05 21:32           ` Peter Stephenson
2012-10-05 21:54             ` Christian Neukirchen
2012-10-07 17:51               ` Peter Stephenson
2012-10-05 22:24             ` Peter Stephenson
2012-10-06  7:56             ` Bart Schaefer [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=121006005631.ZM936@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@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).