develooper Front page | perl.perl6.language | Postings from May 2004

Re: C style conditional statements

Thread Previous | Thread Next
Aaron Sherman
May 12, 2004 11:04
Re: C style conditional statements
Message ID:
On Wed, 2004-05-12 at 11:22, Simon Cozens wrote:
> (Luke Palmer) writes:
> > familiar.  You'll find this in the earlier Exegeses, Piers Cawley's
> > article "Perl 6: Not Just for Damians"
> > (, some of the
> > presentations from the last few conference seasons, and scattered about
> > the community.
> These things are all convincing examples of how friendly and familiar
> Perl 6 was three years ago.

Right off the bat, let me say that I've read A1-6, E7, A12, S3, S6, E1,
E6 and much of this mailing list, but I'm still not sure that all of
what I'm going to say is right. Please correct me if it's not.

Perl 5:

        while(<>) {

Perl 6:

        while $stdin.getline -> $_ {

is it really that new and scary? The wonky old STDIO is probably going
to go and get replaced with an IO::Handle like interface (I don't think
that's final, but I recall it being said), but that's NOT new, it's just
changing over to the long-established and removing the Perl3ish IO

The options go on the beginning of the regexp. Ok, fine. No big deal.

The funky -> syntax replaces implicit $_ization of while parameters...
good change IMHO.

. replaces -> for invoking/dereferencing. Again, a good visual change,
and no real hardship to get used to unless string-. has just broken your
brain forever. Using ~ instead of _ for concatenation was a recent break
from the A1-3 ideas, and I'm glad of it. _ was a poor choice due to
variable naming rules, forcing a bit too much whitespace dwimery.

Other than that it's Perl as you've always known it. Any Perl 5
programmer should be able to look it over and figure it out with perhaps
just one or two hints.

Ok, another:

        use IO::Socket::INET;
        	print <$s>;
        	close $s;

Perl 6:

        use IO::Socket::INET;
        my IO::Socket::INET $n = (LocalPort=>20010,Listen=>5);
        while ($s=$n.accept()) {

Again, not much difference. STDIO is still the biggest visual change.
Page after page after page of A12, and still this code looks the same.
I'd say that's a win!

Ok, now I admit that:

        package Foo;
        require Exporter;
        our @ISA=qw(Exporter);
        sub new {
        	my $class = shift;
        	return bless {@_}, $class;
        sub bark {
        	my $self = shift;
        	return $self->{bark};

looks quite a bit different from:

        class Foo {
        	has $.bark;

But really... which would you prefer?! Will code break? Sure (well, not
counting compatibility mode, which is a very good idea), but I'm happy
to move forward with the language after years of essentially static
mucking about with Perl 5. Yeah, "our" is new. Yeah, threads have become
usable. But overall, the language still suffers from most of the things
that were "ok enough to release Perl 5" more than 10 years ago... it's

If anything though, over the last 2 years, more and more Perl 5 culture
has re-asserted itself over the design on Perl 6.

Aaron Sherman <>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About