Programming ≈ Fun

Written by Krešimir Bojčić

Perl 6 the Holy Grail or Utopia?

I think it was Josh Susser that first said:

Ruby is the love child of Lisp and Smalltalk, raised by Perl the eccentric nanny.
I really liked that quote. Of course I hated Perl at a time for being cryptic, outdated and old school. I assumed Perl had a little influence on Ruby, not even close to influence that Smalltalk and Lisp had.

After a couple of years of looking at Lisp, Smalltalk and Perl I would say: “Ruby is a Perl sister that’s not doing drugs”. She is more lovable but also less intriguing and wild.

Sweet Tooth

At the one side we have a Lisp. It has no syntax sugar. It’s even proud of it. On the other side we have Perl. It has ALL the syntax sugar and then some. It’s even proud of it.

These are both valid approaches. It depends on personal taste where on the scale you decide to settle. My pick is Ruby, some other people may prefer Python.

I pity them because Python feels like jail to me since it has all of those “purity”, “sanity” (however you want to call them) constraints. They pity me because I shoot myself in a bart every once in a while (and only occasionally cut my throat) because Ruby lacks some of those constraints.

This goes in circles as a classical holy war tends to, but I had an epiphany yesterday, while watching Perl vs Python debate live from OSCON 2011.

Debate boils down to Python guy making fun of Perl guy for known Perl cruft and twarts. On the other side Perl guy is saying. We pioneered this, we pioneered that, we pushed the envelope on this… You can say that he could not care less about counter arguments since he is looking forward and not fixating on the past.

Inventors and Copycats

That made me wonder. I am already leaning toward “more-is-better” for syntax sugar school. I guess most people are, that’s why majority feels Lisp looks a bit oatmealish. We as humans are capable of graphical mappings. The Chinese grapheme system is proof of that. If you ask me my honest engineer opinion on that system and assign me a task to work on it I would probably like to see the authors of it dealt with like this. Nevertheless it seems to be working nicely for the Chinese.

Maybe it’s the same with Perl guys. That’s why they don’t mind when some Python guy makes fun of them with arguments:

You have 6 options, we’ve chosen to implement half of the third one. That’s why we are superior.

After learning Perl 5 I was feeling like Matz lifted all the good stuff from the Perl while not going wild on syntax sugar. It felt like purified Perl that has stolen Smalltalk messaging system in which the object orientation was not an afterthought. Suddenly Perl was worth a lot more on my scale. (Simultaneously I was able to pinpoint that Python feels like Ruby that hates Perl and therefore lacks all the goodies my heart longs for.)

I toyed with Perl samples and I was able to get results in Ruby with similar LOC. Ruby just felt a lot cleaner, especially in OO department and at the same time didn’t lack much feature/freedom/syntax sugar wise.

Project Utopia

But the elusive Perl 6 that is being made fun of since late 2001 is a different story. I mean they’ve changed everything. When Larry Wall jokingly says that they plan to leapfrog all the other languages I think he is not joking at all.

After using Rakudo Star and reading through language overview I am impressed. So many interesting ideas made my head spin.

As far as I am concerned they are pushing the envelope on these things:

  1. Function signatures (captures, named, optional, alternative named)
  2. Unpacking (destructuring)
  3. Multidispach
  4. Regular expressions
  5. Passing params from console(MAIN)
  6. Grammars and grammar inheritance
  7. Subtypes
  8. Hyper operator (Yay a new syntax sugar »«)

And also they’ve catched up on:

  1. OO syntax
  2. Roles (Ruby modules, Smalltalk traits)
  3. Introspection

Conclusion

Is Perl 6 Utopia? I hope not. Sure it’s easy to make fun of them for getting stuck because of “second system syndrome” and going insane with the features. BUT if they pull it of it has a potential to become the next great rewrite success story similar to OS X from NeXTSTEP.

Unit that Perl 6 can be a great inspiration for some amazing features that can get added to your language of choice.

On a side note it still puzzles me why is Python the only one without blocks. I mean everybody and their mother, including Objective-C has blocks syntax. Are anonymous functions not worthy of having proper representation.

No block for you

« Lisp Is The Red Pill of Truth Compatibility Matters! »

Comments

Copyright © 2019 - Kresimir Bojcic (LinkedIn Profile)