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

Return type and containerization of [] metaops #6155

Closed
p6rt opened this issue Mar 16, 2017 · 5 comments
Closed

Return type and containerization of [] metaops #6155

p6rt opened this issue Mar 16, 2017 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Mar 16, 2017

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

Searchable as RT131009$

@p6rt
Copy link
Author

p6rt commented Mar 16, 2017

From @zoffixznet

While adding a test[^1] it was discovered that `[]` metaops containerize their product sometimes​:

Inconsistent containerization​:
  <Zoffix> m​: say ([\,] <a b>, <c d>).perl
  <camelia> rakudo-moar 79f268​: OUTPUT​: «(($("a", "b"),), ($("a", "b"), $("c", "d"))).Seq␤»
  <Zoffix> m​: say ([,] <a b>, <c d>).perl
  <camelia> rakudo-moar 79f268​: OUTPUT​: «(("a", "b"), ("c", "d"))␤»

Inconsistent return type​:
  <Zoffix> m​: say WHAT ([,] <a b>, <c d>)
  <camelia> rakudo-moar 79f268​: OUTPUT​: «(List)␤»
  <Zoffix> m​: say WHAT ([\,] <a b>, <c d>)
  <camelia> rakudo-moar 79f268​: OUTPUT​: «(Seq)␤»

Lastly, by reading the code alone, there looks to be another inconsistency where some triangle reduction
metas .push[^3], while others .append[^4] their values. There was one change[^5] from .append to .push that
fixed a problem[^6], but looks like other meta op configurations still have it.

IMO it's important to have consistency in all three of these aspects in order for users to be able to easily
predict what sort of return values they would obtain.

[1] https://github.com/perl6/roast/blob/ecf59598811cbe6a8c751f3ae342868f10de126c/S13-overloading/metaoperators.t#L50-L60
[2] Raku/roast@c30eb54#commitcomment-21359198
[3] https://github.com/rakudo/rakudo/blob/79f2681004224108b2acd18bec21b76803eb8fcd/src/core/metaops.pm#L407
[4] https://github.com/rakudo/rakudo/blob/79f2681004224108b2acd18bec21b76803eb8fcd/src/core/metaops.pm#L427
[5] rakudo/rakudo@d56501a
[6] https://rt-archive.perl.org/perl6/Ticket/Display.html?id=130610

@p6rt
Copy link
Author

p6rt commented Mar 18, 2017

From @zoffixznet

The comments on return type are bogus, since non-triangle meta op can return whatever type the op produces...

@p6rt
Copy link
Author

p6rt commented Mar 21, 2017

From @FCO

Em Sat, 18 Mar 2017 13​:38​:24 -0700, cpan@​zoffix.com escreveu​:

The comments on return type are bogus, since non-triangle meta op can
return whatever type the op produces...

The fiz can be found at rakudo/rakudo#1046
And the tests at Raku/roast#258

@p6rt
Copy link
Author

p6rt commented Mar 21, 2017

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

@p6rt p6rt closed this as completed Mar 21, 2017
@p6rt
Copy link
Author

p6rt commented Mar 21, 2017

@FCO - 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