zsh-workers
 help / color / mirror / code / Atom feed
* Re: Bug#480889: zcompiling messes with alias-in-function expansion
       [not found] <20080512145509.GA15757@lapse.madduck.net>
@ 2008-05-12 16:04 ` Clint Adams
  2008-05-12 16:13   ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Clint Adams @ 2008-05-12 16:04 UTC (permalink / raw)
  To: zsh-workers; +Cc: martin f krafft, 480889

I imagine that this is somehow related to

alias foo='echo bar'; foo

On Mon, May 12, 2008 at 03:55:09PM +0100, martin f krafft wrote:
> % cat <<_eof > foo
> alias foo='echo bar'
> fn() { foo }
> foo
> which foo
> _eof
> % . ./foo
> bar
> foo: aliased to echo bar
> % unalias foo; unfunction fn
> % zcompile foo
> % . ./foo
> ./foo:3: command not found: foo
> foo: aliased to echo bar
> 
> 
> OUCH!


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug#480889: zcompiling messes with alias-in-function expansion
  2008-05-12 16:04 ` Bug#480889: zcompiling messes with alias-in-function expansion Clint Adams
@ 2008-05-12 16:13   ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2008-05-12 16:13 UTC (permalink / raw)
  To: zsh-workers, 480889

Clint Adams wrote:
> I imagine that this is somehow related to
> 
> alias foo='echo bar'; foo

Right, it's the same problem.  Aliases are expanded early on, during
input, and so you can't use an alias within the same chunk of shell code
as where it's defined.  This isn't going to change; you need to find a
workaround.  The standard approach is to use functions in such chunks of
code.  Aliases tend to be regarded as largely an interactive feature.

This ought to be documented somewhere, if it isn't.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-12 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20080512145509.GA15757@lapse.madduck.net>
2008-05-12 16:04 ` Bug#480889: zcompiling messes with alias-in-function expansion Clint Adams
2008-05-12 16:13   ` Peter Stephenson

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).