On Mon, Jun 10, 2019 at 10:22:09AM -0400, Matthew Horsfall (alh) wrote: > On Wed, Jun 5, 2019 at 5:30 AM Dave Mitchell <davem@iabyn.com> wrote: > > At the moment its reasonably clear that where you explicitly use the '.' > > operator (and double-quoted strings, which are syntactic sugar for > > concatenation) you should expect concat overloading to be honoured. > [...] > > > > We should keep a clear distinction between: > > > > concat operator '.' appears in the source code > > > > and > > > > perl concatenates two strings for some reason. > > To me "" seems like the latter, not the former. > > This is probably documented somewhere but I find it surprising that > "$foo" calls concat overloading on $foo before string overloading. I'm not sure I follow. "$foo" calls '""' overloading, not '.': This: use overload '""' => sub { print "STRFY($_[0][0])\n"; $_[0][0] }, '.' => sub { print "CONCAT$_[0][0], $_[1][0])\n"; bless [ $_[0][0] . $_[1][0] ] } ; my $s = bless [ "foo" ]; my $t = "$s"; outputs: STRFY(foo) -- Diplomacy is telling someone to go to hell in such a way that they'll look forward to the tripThread Previous | Thread Next