develooper Front page | perl.perl5.porters | Postings from June 2019

Making join() respect string-concat operator

Thread Next
Paul "LeoNerd" Evans
June 4, 2019 17:42
Making join() respect string-concat operator
Message ID:
(this is simpler rehash of )

I would like core's join() operator to respect the string-concat
operator overloading of any arguments passed to it.

I.e. that the result of

  join( $sep, $x, $y, $z )

always be indistinguishable from the result of

  $x . $sep . $y . $sep . $z

even if any of $sep, $x, $y or $z has operator overloading.

In particular, if any of those operators returned an object rather than
a plain string, then the overall join() operator should by now have
returned that object.

As things currently stand, join() always stringifies each argument
individually, then yields a plain string containing all the characters
concatenated into it.

I am happy to write docs and tests, and implement this.


Stating my interest: I am the author of

Paul "LeoNerd" Evans      |  |

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About