November 2011 Archives

Perl is not a multi-paradigm language

Perl is a dialecting programming language.

A dialecticing language is a super-set of a multi-paradigm language. Lisp is another dialecting language.

Unlike lisp, where everything looks like an s-exp, a Perl dialect will look ridiculously different from Perl.

Officially, I think we can recognize the following dialects of Perl

  • Perl[1-4] : the Perl that everyone hates
  • CPAN perl : a dialect of Perl, which emerged with maintainability, readability and reusability as the core concern. (The changes introduced in Perl5 started the dialecting trend in Perl)
  • Perl5.[10-14+] aka Modern Perl : another dialect of Perl, now recommended for both script writers and cpan users. Modern Perl is that which adhres to the Grammar Nazi.

Any code that passes through Perl::Critic and Perl::Tidy is a safe bet on robustness and clarity, which is an improvement over the earlier dialects.

With a couple of modules you can even write Perl like ruby.

Using BEGIN and END blocks you can write Perl like awk.

Higher Order Perl by mjd gives Perl a functional spin.

A dialecting programming language has good consequences

  • Speaking it, Writing it is fun
  • Experimentation and all the good things it leads to
  • Adaptability (This is by far the biggest asset of perl)
  • Immortality
  • Freedom of expression reigns supreme
  • The possible "solution space" is broader
  • Good practices change with the discovery of new solutions

The terrible consequences

  • A dialect puts a strain on the parent community
  • Old dialects die hard
  • Debugging is a pain
  • Translation is difficult
  • There is an initial training cost involved in learning a new dialect (but not too much)
  • "Code is foreverrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"
  • A dialect, can become embedded in a local community

Both good and terrible

  • A module in CPAN has the potential to completely affect the way you think or write in Perl. (For the paranoid, an experimental dialect always comes with bells and whistles)

This is problem that Perl shares with Lisp. And frankly perl is becoming more lisp like with reader-macros.

Any one who wants to be a Perl developer _has_ to come to terms with this basterd nature of Perl.

inglourious_basterds.jpg

Different things should look different is not a natural language principle.

TL;DR version
Perl is inspired from english fucking grammar, *not* english fucking language.

You see what Ich did there ? I used the word "fucking" two times. In both instances, I placed it between two different words. The communicated result is free fucking emphasis.

The idea of adding *fucking* in between two words for emphasis is a very interesting principle.

my fucking lunch.
my fucking life.
bang fucking bang.

The fact that it can be placed between two arbitrary words is *important*.…

Why I dislike frameworks

Frameworks are like declarative programming systems built over a language. They are not general, and they don't always tell you this, which is _clever marketing_ on their parts.

I have been burned by _clever marketing_ enough number of times so as to hate them.

Declarative systems are good, but when they are bad it's terrible. And they are not refactoring friendly, but copy paste friendly.

For me declarative programming languages/systems are hard to learn, because the "generality" is lost by the jump to declarative programming. Declarative programming languages are jus…

About [deleted]

user-pic I blog about Perl.