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

Re: Reserved words and aliases

> The problem is a Z-shell Kludge (TM):  the aliases and reserved words
> shared the same hash table.  The old behaviour was that making exec
> an alias stopped the real exec from being recognised as a shell
> reserved word and this couldn't be undone.
> I could have fixed this by compounding the kludge, e.g. by adding an
> extra flag if an alias was a reserved word that was aliased.  Instead
> I decided to do it properly and put the reserved words in their own
> hash table.  This enabled some minor data size optimisations at the
> expense of some minor code increase.  It also opens the way in future
> to turn off aliases as an option if that ever becomes necessary.

Totally excellent!  I think there are some other tables that probably
should be split like this.

> There is the odd minor but reasonable change in behaviour, for example
> compctl's alias flag won't produce reserved words any more (they still
> appear for command completion and spell checking).

I guess we will need (yet another) flag to match reserved words.  I
consider that a small price to pay for this particular cleanup.

> You can now do
> % alias exec="((SHLVL++, SAVEHIST=0)); exec"
> if you really want.

I'm not sure why you would want to do this, but it's cool that
it will be possible.


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