[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Perl Moral Support



Tom Rathborne <tomr@aceldama.com> writes:

> [...]
> 
> As much as I appreciate the good-clean-CS-theory approach of Python, I
> think it's a crock - I'm with Larry Wall on the natural-language end
> of things. 

Actually, it was good-clean-CS-theory reasons that made me choose Perl
rather than Python.  And it wasn't the "fun" I had with Python
indentation (then again, I even enjoyed programming some Haskell at
university; Python indentation is just plain boring after that).  Nor
was it Perl's syntax, which I find rather baroque (why can't we all
just use Scheme?).

No, what Perl has that Python doesn't is good-clean-CS-theory
*closures*.  Both languages let you have functions as (nearly)
first-class objects (i.e. you can store a function in a variable,
return it from a function, store it in an array, etc.).  But only Perl 
does it usefully.  In Perl, functions in an internal scope can use all 
the `my' variables defined in their defining scopes; last time I
looked at Python, it *still* didn't do that, and required me to pass
in the extra variables as default-value parameters to the inner
function.  YUCK!

sub make_counter {
  my $cnt = 0;
  sub { $cnt++ }
}

A plus for Python is probably that wrapping C functions for use from
Python is much more pleasant; at least, my Python-hacking friends
assure me that this is the case.  Perl is fairly awful in this regard.

Of course, both languages are perfectly usable.  Does anybody know of
a _mixed_ Perl/Python shop?

-- 
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            |ariels@compugen.co.il
Compugen Ltd.          |Tel: +972-2-6795059 (Jerusalem)	\ We recycle all our Hz
72 Pinhas Rosen St.    |Tel: +972-3-7658514 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555    http://3w.compugen.co.il/~ariels

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe