Hi,
Reading <http://austingroupbugs.net/view.php?id=1055#c3292>, I'm very
surprised to discover that how aliases work is being completely
rewritten in a way incompatible with existing shells and existing shell
scripts. No reason is given for this, so I'm asking for one here. I
would have imagined that the point would be to ensure that something like
alias p=echo; p Hello
works, where in existing shells it does not, but that still will not
work even under the new wording.
Reading a complete_command first, and only applying alias substitution
after that, cannot handle aliases that affect how the command would be
parsed. That is, reading a complete_command first cannot possibly hope
to handle something like
alias mycase=case
mycase x in (x) echo ok ;; esac
since it would detect a syntax error on the unexpected ( before
expanding the alias. In fact, there seems to be no new wording to handle
any re-parsing of aliases involving shell reserved words at all. All
existing implementations of aliases that I can find do support this, and
aliases involving shell reserved words are actually used: just a quick
search shows that multiple people have come up with something resembling
alias forever='while :; do'
Is the intent really to invalidate such uses? If so, is the intent to
require shells to issue errors for this, or will shells somehow be
allowed to continue implementing it the way it is currently required?
Cheers,
Harald van Dijk