Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: RC_EXPAND_PARAM bug
On Aug 1, 5:17pm, Andrej Borsenkow wrote:
} Subject: Re: RC_EXPAND_PARAM bug
}
} pre-beta16 treats `^' as ternary operator:
} xx$^ayy -> xx^$a^yy (in rc notation)
} current treats `^' as binary operator with right precedence:
} xx$^ayy -> xx($a^y)
}
} Correct me, if I am wrong.
Should that read
xx${^a}yy -> xx^($a^yy)
??
The step you're omitting is that what happens when xx and yy represent
arrays differs from what happens when xx and yy represent strings.
xx${a}yy --> xx^${a}^yy --> xx^(ayy byy) --> xxayy xxbyy
b=(p q)
xx${a}${b} --> xx^(a b)^(p q) --> xx^(ap bq bp) --> xxap xxbq xxbp
c=(m n)
${c}${a}${b} --> (m n)^(a b)^(p q) --> (m n)^(ap bq bp) --> mbp nap nbq nbp
What I find weird about this is the way the first element of the left
side gets paired only with the last element of the right side. One of
the array iterators is not getting started over when it should. The
more elements there are in each array, the stranger it gets.
} Both is acceptable as long as it is documented ;)
I agree that both are acceptable, because they ought to be completely
equivalent! The current behavior is not acceptable because it doesn't
obey any such straightforward operator rule.
} Oh, I almost forgot my proposal ...
}
} - get rid of ^ as subst modifier
} - use explicit operator notation
I think it's far too late for this. Too great an incompatibility with
existing zsh. (We could add an operator notation, but we can't get rid
of the subst modifier.)
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author