# New Ticket Created by  Zoffix Znet 
# Please include the string:  [perl #131009]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=131009 >


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] 
https://github.com/perl6/roast/commit/c30eb545b82467ab577c9a04d41a459819a58fb9#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] 
https://github.com/rakudo/rakudo/commit/d56501a65dab442acd64ad00d52483a53ed7fe40
[6] https://rt.perl.org/Ticket/Display.html?id=130610

Reply via email to