Jump to content

User:Shlomif/Perl for Python and Ruby Programmers

From Wikibooks, open books for an open world

Introduction

[edit | edit source]

All languages of the world suck. If you require people to declare variables (like in Pascal, C, Scheme or Perl 5 with strict), then people will tell you they like variables to spring up upon first. Without variable declarations, then you get various weird side-effects of the implicit scoping. If you use curly braces for scoping, then you'll have to type more and there's more clutter. With indentation-based scoping (like in Python), you'll find it hard to introduce multiple-expression lambdas.

Rob Pike and Paul Graham hated object oriented programming (OOP) and so they didn't introduce it in their "Go" and "Arc" languages well after OOP has become mainstream. And guess what? Many people, including me, think that OOP is still a good thing (and no - C++ did not do OOP properly, according to most people) and so gave up on Arc quickly and did not look closely at Go.

Dynamically typed languages (like Perl 5, Python, Ruby, or Lisp) possibly suffer from many subtle errors ; Statically typed languages (like Haskell) are less expressive and it seems that about one third of the language design papers published on Lambda the Ultimate are about weird extensions to the Haskell type system to allow for better expressiveness.

Purely functional languages have no assignment and most people find them harder, in part because the world around us has a lot of state, and they also need to do funky compiler tricks to make you feel like you don't need assignment. Non-functional languages have side-effects and so are prone to many errors.

If you have goto or goto-like statements (such as exceptions or Perl 5's "last LABEL;" (more like "break" in C) or "next LABEL;"), then you encourage code to not be factored correctly. If you don't have such stuff, then programmers will hate you for having to go through many hoops to write quick-and-dirty code.

Perl 5 has a dedicated regular expression syntax which is treated magically by the compiler. PHP and Java treat those as strings, and require weird escaping and backslashing rules to interpolate the sub-regexes inside them.

You are damned either way, whatever you do.