Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-defined operators lose the LTM match even when they ought to win it in Rakudo #2760

Closed
p6rt opened this issue May 11, 2012 · 5 comments
Closed

Comments

@p6rt
Copy link

p6rt commented May 11, 2012

Migrated from rt.perl.org#112870 (status was 'resolved')

Searchable as RT112870$

@p6rt
Copy link
Author

p6rt commented May 11, 2012

From @masak

<flussence> r​: multi sub infix​:<~eq>(Str $a, Str $b) { uc $a eq uc $b
}; say 'Foo' ~eq 'foo'
<p6eval> rakudo d61049​: OUTPUT«===SORRY!===␤CHECK FAILED​:␤Undefined
routine '&eq' called (line 1)␤»
<tadzik> probably gets parsed as 'Foo' ~ eq('foo')
<PerlJam> sounds like a failure of LTM
<tadzik> aye
<masak> it does.
<masak> r​: multi sub infix​:<$$$>($a, $b) {}; say 1 $$$ 1
<p6eval> rakudo d61049​: OUTPUT«Nil␤»
<masak> hm, seems that Rakudo recognizes new infix operators without a problem.
<masak> r​: multi sub infix​:<+->($a, $b) { 42 }; say 1 +- 1
<p6eval> rakudo d61049​: OUTPUT«0␤»
<tadzik> LTA LTM
<masak> but longest doesn't win if it's user-defined.
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Jun 11, 2012

From @jnthn

On Fri May 11 10​:03​:47 2012, masak wrote​:

<flussence> r​: multi sub infix​:<~eq>(Str $a, Str $b) { uc $a eq uc $b
}; say 'Foo' ~eq 'foo'
<p6eval> rakudo d61049​: OUTPUT«===SORRY!===␤CHECK FAILED​:␤Undefined
routine '&eq' called (line 1)␤»
<tadzik> probably gets parsed as 'Foo' ~ eq('foo')
<PerlJam> sounds like a failure of LTM
<tadzik> aye
<masak> it does.
<masak> r​: multi sub infix​:<$$$>($a, $b) {}; say 1 $$$ 1
<p6eval> rakudo d61049​: OUTPUT«Nil␤»
<masak> hm, seems that Rakudo recognizes new infix operators without a
problem.
<masak> r​: multi sub infix​:<+->($a, $b) { 42 }; say 1 +- 1
<p6eval> rakudo d61049​: OUTPUT«0␤»
<tadzik> LTA LTM
<masak> but longest doesn't win if it's user-defined.
* masak submits rakudobug

Now works thanks to using QRegex for parsing​:

multi sub infix​:<~eq>(Str $a, Str $b) { uc($a) eq uc($b) }; say 'Foo'
~eq 'foo'
True

(Note, original code got precedence wrong.)

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Jun 11, 2012

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 12, 2013

From @moritz

Now tested in S06-operator-overloading/sub.t.

@p6rt
Copy link
Author

p6rt commented Jan 12, 2013

@moritz - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant