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

Arity counting mis-treats slurpy and capture parameters #2664

Closed
p6rt opened this issue Mar 9, 2012 · 7 comments
Closed

Arity counting mis-treats slurpy and capture parameters #2664

p6rt opened this issue Mar 9, 2012 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Mar 9, 2012

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

Searchable as RT111646$

@p6rt
Copy link
Author

p6rt commented Mar 9, 2012

From @moritz

09​:38 < moritz> nom​: say &infix​:<>.arity
09​:38 <+p6eval> rakudo 4235df​: OUTPUT«1␤»
09​:38 < moritz> nom​: say &infix​:<
>.count
09​:38 <+p6eval> rakudo 4235df​: OUTPUT«1␤»
09​:38 < moritz> ah, that's wrong
09​:39 < moritz> nom​: say &infix​:<~>(2, 3)
09​:39 <+p6eval> rakudo 4235df​: OUTPUT«23␤»

This leads to @​list.reduce(&infix​:<~>) failing, because reduce thinks it
got an unary operator.

@p6rt
Copy link
Author

p6rt commented Mar 9, 2012

From @moritz

Golfed even further​:

09​:44 < moritz> nom​: multi a($, $) { }; say &a.arity
09​:44 <+p6eval> rakudo 4235df​: OUTPUT«1␤»

Seems the arity calculation is generally a bit off

Am 09.03.2012 09​:41, schrieb Moritz Lenz (via RT)​:

# New Ticket Created by Moritz Lenz
# Please include the string​: [perl #​111646]
# in the subject line of all future correspondence about this issue.
#<URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=111646>

09​:38< moritz> nom​: say&infix​:<>.arity
09​:38<+p6eval> rakudo 4235df​: OUTPUT«1␤»
09​:38< moritz> nom​: say&infix​:<
>.count
09​:38<+p6eval> rakudo 4235df​: OUTPUT«1␤»
09​:38< moritz> ah, that's wrong
09​:39< moritz> nom​: say&infix​:<~>(2, 3)
09​:39<+p6eval> rakudo 4235df​: OUTPUT«23␤»

This leads to @​list.reduce(&infix​:<~>) failing, because reduce thinks it
got an unary operator.

@p6rt
Copy link
Author

p6rt commented Mar 9, 2012

From @moritz

Further analysis​: the problem is that Signature.count counts the (|$)
from the proto as a single positional.

The obvious fix from http://moritz.faui2k3.org/tmp/arity.patch doesn't
work, because List.munch then gets a Num argument, which blows up during
unboxing.

@p6rt
Copy link
Author

p6rt commented Mar 23, 2012

From @pmichaud

Now fixed in 69920db585.

  > say &infix​:<>.arity
  0
  > say &infix​:<
>.count
  Inf
  > say <a b c d>.reduce(&infix​:<~>)
  abcd

Ticket can be closed when we have appropriate spectests.

Thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Mar 23, 2012

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

@p6rt
Copy link
Author

p6rt commented Apr 5, 2012

From @moritz

now tested in S06-signature/arity.t

@p6rt
Copy link
Author

p6rt commented Apr 5, 2012

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

@p6rt p6rt closed this as completed Apr 5, 2012
@p6rt p6rt added the testneeded label Jan 5, 2020
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