We need a way to mix eq, the things to be compared, and the operation
to be done on them before they are compared:
lc{ $foo eq $bar }
$foo eq (lc) $bar
$foo eq{lc} $bar
None of those are like any existing syntax in Perl. The current way:
lc($foo) eq lc($bar)
seems fine in comparison.
I'd say this argues for the parser to be told about new infix operators:
use operator
'eqi' => 'infix';
$blah eqi $bork
# rewritten as eqi($blah,$bork)
This raises another issue, though:
You'd obviously want to have a module that collected together your
favourite new operators. But if they were lexically scoped, they'd
be lexically scoped to the module they were defined in, i.e. your
collection rather than your main program. We're going to have to
think of a way to consistently say "do this in my caller's lexical
scope" without it becoming a nasty upvar hell.
Nat
- RFC 143 (v1) Case ignoring eq and cmp operators Perl6 RFC Librarian
- Re: RFC 143 (v1) Case ignoring eq and cmp operato... Jarkko Hietaniemi
- Re: RFC 143 (v1) Case ignoring eq and cmp operato... Kevin Walker
- Upscope (was Re: RFC 143) Nathan Torkington
- Upscope (was Re: RFC 143) John Porter
- Re: RFC 143 (v1) Case ignoring eq and cmp... Bryan C . Warnock
- Re: RFC 143 (v1) Case ignoring eq and cmp... David L. Nicol
- Re: RFC 143 (v1) Case ignoring eq and... Nathan Torkington
- Re: RFC 143 (v1) Case ignoring eq and cmp operato... Tom Christiansen
- Re: RFC 143 (v1) Case ignoring eq and cmp ope... Dan Sugalski
- Re: RFC 143 (v1) Case ignoring eq and cmp... Tom Christiansen
- Re: RFC 143 (v1) Case ignoring eq and... Dan Sugalski
- Re: RFC 143 (v1) Case ignoring e... Nathan Torkington
- Re: RFC 143 (v1) Case ignoring eq and cmp ope... Jarkko Hietaniemi
