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
- Re: Strings vs Numbers (Re: Tying & Overloading) Branden
- Re: Strings vs Numbers (Re: Tying & Overloading) Bart Lateur
- Re: Strings vs Numbers (Re: Tying & Overloading) Larry Wall
- Re: Strings vs Numbers (Re: Tying & Overloading) Graham Barr
- Re: Strings vs Numbers (Re: Tying & Overloading) John Porter
- Re: Strings vs Numbers (Re: Tying & Overloading) John L. Allen
- Re: Strings vs Numbers (Re: Tying & Overloading) Michael G Schwern
- Re: Strings vs Numbers (Re: Tying & Overloading) Edward Peschko
- Re: Strings vs Numbers (Re: Tying & Overloading) Edward Peschko
- Re: Strings vs Numbers (Re: Tying & Overloading) Michael G Schwern
- Re: Strings vs Numbers (Re: Tying & Overloading) Nathan Wiger
- Re: Strings vs Numbers (Re: Tying & Overloading) John L. Allen
- Re: Strings vs Numbers (Re: Tying & Overloading) Edward Peschko
- Re: Strings vs Numbers (Re: Tying & Overloading) Larry Wall
- Re: Strings vs Numbers (Re: Tying & Overloading) Edward Peschko
- Re: Strings vs Numbers (Re: Tying & Overloading) Larry Wall
- Re: Strings vs Numbers (Re: Tying & Overloading) Peter Scott
- Re: Strings vs Numbers (Re: Tying & Overloading) Randal L. Schwartz
- Re: Strings vs Numbers (Re: Tying & Overloading) Bart Lateur
- Re: Strings vs Numbers (Re: Tying & Overloading) Larry Wall
- Re: Strings vs Numbers (Re: Tying & Overloading) Bart Lateur