Hi everyone!  My name is Miko O'Sullivan, and I've been a devoted Perl
Hacker for several years now. I'm looking forward to participating in the
discussion of Perl 6.  To give a little perspective on my comments, I got my
degree in Marketing about a decade ago, and I've never quite decided if I'm
a marketer who programs or a programmer who markets.  Indeed, the three
people who have most influenced my programming have been Larry Wall, Donald
Knuth, and Liberace.  The Great Liberace is on the list because of his
motto: "Give The People What They Want".

In the context of Perl 6, what do The People Want?  When I'm writing modules
and other things that other developers will use, I usually find that the #1
thing they want is ease-of-understanding: if they can't understand it
between two bites of ramen, it's too complicated.

With that verbose introduction in mind, I'd like to jump in the waters of
the discussion with this concern.  In Exegesis 3 Damian suggests default
params like this:

   sub load_data ($filename ; $version / /= 1) {...}

(Disclaimer: I'm putting a space between / and / because otherwise my mail
client does funny things with the text.  Sheesh.) Now, I'm thrilled about
/ /= . However, the technique for defaulting params seems a unnecessarily
complicated.  The following code could mean just the same thing.

    sub load_data ($filename ; $version = 1) {...}

It all depends on how you read it.  If you read it as "first get @_, then
overlay it with these new variables" then only / /= makes sense.  But if you
read it "create these new variables, then overlay it with @_" then they both
make sense.  It's sorta like %options = ('version' => 1, @_);  The great
advantage of the latter structure is that it's easier to understand, and
(dare I say it?) it's the way other programming languages work.  Perl 6 is
already getting a reputation as ten times more cryptic than Perl 5, and
though it's always been an undeserved reputation, let's not feed the flames.


Peace and Happy Coding

- Miko


Reply via email to