Michael G Schwern wrote:
>
> On Tue, Apr 24, 2001 at 12:23:33PM -0700, Edward Peschko wrote:
> > ok, well.. I've heard arguments for '+' (namely that its intuitive, other
> > language compatible, etc...) so what are the arguments against it?
>
> This one seems to have slipped by...
> http://archive.develooper.com/perl6-language%40perl.org/msg06550.html
>From that email:
> Consider the following...
>
> sub foo { $_[0] + $_[1] }
>
> What do the following return?
>
> foo(1,1); obviously 2
> foo("this", "that") obvious "thisthat"
>
> Those are simple enough.
>
> foo("1", 1); is that "11" or 2?
> foo(undef, 1); 1 or "1"?
>
> Those can be solved by definining precidence, but its still a bit
> arbitrary.
>
> foo($foo, $bar); who knows?
Based on what I posted, my position would be: &foo returns numeric
addition.
Again, don't think of + as a dual-natured op. That's not what I'm
saying. It remains numeric addition. The C<"" +> operator is your string
concat.
If you wanted foo to return a string concat, you would have to say:
sub foo { "$_[0]" + $_[1] }
(or use "$_[1]", either way). Without the quotes you're not properly
using the operator.
I'm not really fighting for what I posted per se, but I do want to
emphasize it's not the same as what's been discussed before.
-Nate