Most Perl 6 will look like Perl 5

Ovid publiustemp-londonpm at yahoo.com
Fri Jan 25 12:24:35 GMT 2008


--- Matt Johnson <mwj at doc.ic.ac.uk> wrote:

> Most of that doesn't scare me, but the sigil change makes me want to
> run 
> screaming for the hills. Why completely change a paradigm that's
> worked 
> fine for many years (that the sigil designates the return type) -- to

Because experienced Perl programmers don't notice it, but it's one of
the biggest sources of confusion for programmers learning the language.
Randal's commented about how they restructured Stonehenge training
classes to work around student confusion regarding the sigil (this has
shown up in the llama book).  It's a shame that such a core feature of
the language has confused so many people, so Perl 6 attempts to get
around one of our biggest stumbling blocks.

In Perl 6, because the sigil is now part of the variable name, it no
longer indicates what the lvalue receives, or what we're referencing,
or whatever the hell it's doing.  @foo is an array, period. It's not
some weird hash pretending to be an array or anything.  Because sigils
will be invariant, we can get rid of the following abhorrent syntax:

  my @foo = @bar{ 1, 2 };
  my @foo = @bar[ 1, 2 ];

Most of us don't think twice about that, but that's awfully subtle for
a new programmer.  Now you get this:

  my @foo = %bar{ 1, 2 };
  my @foo = @bar[ 1, 2 ];

That's *much* easier to see.  It also cleans up dereferencing syntax,
but I'll stop now.  I suspect that going on would be akin to trying to
explain to Republicans why they should have liked Bill Clinton (he had
a record any Republic would have envied). 

:)

Cheers,
Ovid

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/


More information about the london.pm mailing list