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

Making join() respect string-concat operator

Thread Next
From:
Paul "LeoNerd" Evans
Date:
June 4, 2019 17:42
Subject:
Making join() respect string-concat operator
Message ID:
20190604183616.615fd256@shy.leonerd.org.uk
(this is simpler rehash of
  https://www.nntp.perl.org/group/perl.perl5.porters/2010/06/msg160741.html )

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 https://metacpan.org/pod/String::Tagged

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About