develooper Front page | perl.perl6.language | Postings from April 2001

YA string concat proposal

Thread Previous | Thread Next
From:
Michael G Schwern
Date:
April 24, 2001 12:51
Subject:
YA string concat proposal
Message ID:
20010424205150.P2131@blackrider.blackstar.co.uk
Ok, time for me to shot down.

I've already voiced my views about trying to make addition and
concatination into a single operator in a typeless language
http://archive.develooper.com/perl6-language%40perl.org/msg06550.html
and I think its a losing proposition.

So here's something simple.  Sort of a fallback proposal in case
nothing amazingly clever comes up.

cc and ce

        Perl 5                          Perl 6
        print "foo" . "bar";            print "foo" cc "bar;
        print 2 . 4;                    print 2 cc 4;
        print "foo " . ($i + 1);        print "foo " cc ($i + 1);
        $foo .= "bar ";                 $foo ce "bar";

Its unambiguous and its analgous to eq, ne, gt, get, etc...  About the
only problem I can think of is if you define a function called cc() or
ce(), but we live with that already with gt() and friends.

It also has the nice side-effect of preserving '.=' functionality,
which I'd rather not lose (especially after having made fun of 
$foo = $foo . 'bar'; type code).


PS  It doesn't have to specifically be cc and ce.  Just so long as it
matches /^[a-z]{2}$/ and /^[a-z]e$/


-- 

Michael G. Schwern   <schwern@pobox.com>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <perl-qa@perl.org>       Kwalitee Is Job One
I'm going to have to hurt you on principle.

Thread Previous | 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