Wednesday, March 25, 2009

commit b841dc4954c24d0abea43daf407b6bf70e1c450b
Author: Terry ******* ****** <***********@****.***>
Date: Wed Mar 25 07:15:31 2009 +0000


massively improved alias expansions

aliases now expand recursively until resolved or aborted. A circular
alias like x = y; y = z; z = x; will resolve x to x when it hits z. The
expansion of aliases should behave more or less as desired, but without
positonal paramter support

tpsh:
$ alias x='y -opts P'
$ alias y='z -flags PP'
$ alias z='echo z PPP'
$ x one two three
z PPP -flags PP -opts P one two three
zsh:
$ alias x='y -opts P'
$ alias y='z -flags PP'
$ alias z='echo z PPP'
$ x one two three four
z PPP -flags PP -opts P one two three four

At the moment the shell local()'s %ENV before each expansion, and will
likely set 0..$#, $#, $@, and $* accordingly someday; but currently does
not use %ENV for anything. In order to allow macros to change the
environment, we can't just local() %ENV to implement positional params
for macros, but it will be a suitable stop-gap until done fully.

note: alias, macro, and function all revolve around %Macros and
&expand_aliases for macro expansion.


the next big chore is improving the code that invokes expand_aliases(), lol.

No comments:

Post a Comment