On Wed, 4 May 2005, Larry Wall wrote:
> It would be nice to have an easy-to-access "What's this?" interface
> that could be stitched into your favorite editor to identify what's
> under the cursor, or at least a command like:
> p6explain '[+]'
That would make me extremely happy.
> : $sum = [+] @array; # meta operator
Another random thought which came to me (right after "\\+" could be
mnemonic for "return a function ref for this operator") was this:
How does [+] know you mean
reduce &infix:<+>, @array;
reduce &prefix:<+>, @array;
which is nonsense, but the [+] is in a prefix position.
With the hyper metaoperator, the real operator is always in the place
where it would normally be parsed. But this metaoperator pulls the real
operator out of its usual pre/in/post position.
I suppose users will need to know the answer when they start trying to
write their own metaoperators.
Maybe the metaoperator's function signature resolves that somehow?
But I haven't been following the function signature thread closely.
I can see how to ask for a binary (hence infix) operator, but how do I ask
for a prefix or postfix operator specifically, which +<< and >>+ do?
Maybe there are Operator::Prefix, etc, roles defined so you can ask for
~ John Williams
> infix:+( prefix:-($a), $b)
> [Update: That's now
> infix:<+>( prefix:-($a), $b)
The correction only corrected one of the errors:
infix:<+>( prefix:<->($a), $b)