On Sat, May 07, 2005 at 05:11:19PM +1000, Stuart Cook wrote:
: On 5/7/05, Patrick R. Michaud <[EMAIL PROTECTED]> wrote:
: > It might not be a problem -- I'm thinking we may end up tokenizing
: > most or all of the meta operators, so that [+] would be considered
: > its own token, and then the "longest matching token" rule
: > would be sufficient to disambiguate the terms:
: >
: > $x = [+1, -2, +3]; # token [ indicates a term
: > $y = [+] @stuff; # token [+] indicates a meta-op prefix operator
:
: Does that mean postfix meta-ops that modify syntax become possible?
: (Not necessarily a good idea, mind you, but possible...)
Vaguely. One could imagine for instance a hyper variant that says
"do this to yourself", and this could force interpretation of the preceding
operator as an infix operator rather than a unary. So despite the
fact that there's a unary *, this
@squares = *�� @list;
could be the same as
@squares = @list �*� @list
I'm inclined to agree that it's not a terribly good idea to have
a metaoperator that does retroactive violence to the meaning of
an operator. (Note that +� doesn't actually change the meaning of
the +.)
On the other hand, since we've distinguished hyperops on infixes from
hyperops on unaries, maybe an infix hyperop in unary position just
does the thing to itself:
@squares = �*� @list;
which gives us a sum-of-squares that looks like this:
@sumofsquares = [+] �*� @list;
That's...interesting...and it doesn't retroactively change the meaning
of *, since it's got the � out front, which currently has no meaning
when a term is expected, unless I'm going completely senile. Every day
it gets a little harder to distinguish my senility from my insanity...
Larry