Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zcompile does not expand aliases defined in the compiled script



On Tue, Jul 7, 2020 at 10:28 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> It is possible that you changed the example in the mail without trying
> what you changed; if you have the statements
> alias x=:
> x
> in the file x, then sourcing it (non-compiled) will work

Yes, that's exactly it. Given a script like this:

  alias x=:
  x

Sourcing it without zcompile works (`x` on the second line is
alias-expanded), but once the script is zcompiled an attempt to source
it results in an error (`x` doesn't get expanded).

I looked at the source code of zcompile and I understand why this
happens. It makes perfect sense when zcompiling functions. It is,
however, surprising when zcompiling scripts.

Roman.



Messages sorted by: Reverse Date, Date, Thread, Author