On Wed, 2004-05-12 at 11:22, Simon Cozens wrote:
> [EMAIL PROTECTED] (Luke Palmer) writes:
> > familiar.  You'll find this in the earlier Exegeses, Piers Cawley's
> > article "Perl 6: Not Just for Damians"
> > (http://www.perl.com/pub/a/2001/10/23/damians.html), 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:

        #!/usr/bin/perl
        
        while(<>) {
                s/\w+/WORD/g;
                print;
        }

Perl 6:

        #!/usr/bin/perl
        
        while $stdin.getline -> $_ {
                s:g/\w+/WORD/;
                $stdout.print;
        }

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
syntax.

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:

        #!/usr/bin/perl
        
        use IO::Socket::INET;
        $n=IO::Socket::INET->new(LocalPort=>20010,Listen=>5);
        $n->listen();
        while(($s=$n->accept())){
                print <$s>;
                close $s;
        }


Perl 6:

        #!/usr/bin/perl
        
        use IO::Socket::INET;
        my IO::Socket::INET $n = (LocalPort=>20010,Listen=>5);
        $n.listen();
        while ($s=$n.accept()) {
                $stdout.print($s.getlines);
                $s.close;
        }

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 [EMAIL PROTECTED], $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
time.

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 <[EMAIL PROTECTED]>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback


Reply via email to