develooper Front page | perl.perl5.porters | Postings from June 2006

Re: Its time we set the score straight on Perl 5 and Perl 6 and debunk our own self generated FUD.

June 16, 2006 09:31
Re: Its time we set the score straight on Perl 5 and Perl 6 and debunk our own self generated FUD.
Message ID:
Tom Horsley skribis 2006-06-16 12:14 (-0400):
> > > Perl really is a write-only language, 
> > What leads you to that conclusion ?  
> The fact that so many features of perl were added specificly to
> encourage shorthand gibberish for the use of folks writing quick
> hacks.

There's a huge difference between providing something and encouraging
it. Perl lets you do horrible things, but generally it is discouraged
very strongly.

> Consider || and OR (and friends) with the same meaning but different
> precedence so people can write huge expressions with no parens.

I think this is very important. Note that if you still write "OR" in all
capitals, you're more than a decade behind, as it's "or" now :)

To me, being able to write

    open my $fh, '<', $file or die "$file: $!";

instead of

    open(my $fh, '<', $file) || die("$file: $!");

is very important. I find the former both easier to write and easier to

> C does indeed suffer from the same problem to some extent, but at
> least all the operators actually mean something different. With perl
> this extra nonsense was added specificly to encourage leaving out
> parens and leaving all but language lawyers scratching their head.

You say that as if leaving out parens is a bad thing. And you probably
think it is, but I disagree. That's exactly why it's important to
support multiple styles. As long as I can read your code, and you can
read mine, why should we both write the same way? I'm much more
productive if I can write things in a way that feels right to *me*, and
any employer wants their people to be productive, right?

> Or perhaps an even worse example: barewords.  There's a concept that
> really encourages readable code - quoted strings without quotes.

Practically every Perl book, tutorial, guide, or even introduction,
encourages and recommends "use strict" in the strongest possible terms,
and if you "use strict", these unquoted strings are no longer valid

> Or multiple different syntaxes to call object methods - the call does
> nothing different, you can just write it two or three totally
> different ways.

There are two ways to call a method, and most modern Perl stylists
recommend using only one of them, the direct syntax.

Personally, I don't see why having both



    new MyClass

would be a problem.

> Every time a language aquires totally different syntax with absolutely
> no different meaning between the two, you add another element to the
> set you can take the cartesian product of to generate the number of
> different styles perl can be written in.

There are already infinite Perl styles, so that can't be a problem.
There are also infinite C styles.

In some languages, everything looks the same, like in Python, Ruby, or
Java. But if you look closely, you'll discover that programmers also
have their stylistic preference within those languages. Only it's less
apparent, because these languages use words where Perl uses symbols.

> Unfortunately it requires later maintainers to know the *entire*
> language in minute detail.

But that's not different from other programming languages, really.

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