Duh v D'oh

Paul Makepeace paulm at paulm.com
Thu Nov 13 12:34:54 GMT 2008

On Mon, Nov 10, 2008 at 10:10 AM, Philippe Bruhat (BooK)
<philippe.bruhat at free.fr> wrote:
> On Sat, Nov 08, 2008 at 02:47:51AM +0000, Nigel Rantor wrote:
> > Eden Cardim wrote:
> >>
> >> Yes, that'd be cool and instructive, since I haven't had the time to
> >> dig in to things like Python and Ruby. I'll confess that my vision of
> >> Perl practicity might be clouded by the previous C, C++ and Java
> >> experiences.
> >
> > It would be interesting if we had some basis for comparison.
> There was this project: http://pleac.sourceforge.net/
> PLEAC - Programming Language Examples Alike Cookbook

A more 'meta' example: Compare and contrast working with the debugger,

stix:~$ perl -de0
Loading DB routines from perl5db.pl version 1.28
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(-e:1):   0
  DB<1> $a = {foo => 'bar'}
  DB<2> $a->{foo}
  DB<3> foreach my $k (keys %$a) {
Missing right curly or square bracket at (eval
20)[/usr/share/perl/5.8/perl5db.pl:628] line 4, at end of line
syntax error at (eval 20)[/usr/share/perl/5.8/perl5db.pl:628] line 4, at EOF
  DB<4> foreach my $k (keys %$a) { print $k; }
  DB<5> stix:~$

stix:~$ python
Python 2.4.5 (#2, Aug  1 2008, 12:02:10)
[GCC 4.3.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = {'foo': 'bar'}
>>> a['foo']
>>> for k in a:
...   print k
>>> for k in a: print k

With perl you, a) have to remember some 'trick' to get into the
debugger [-de0 v. nothing] b) can't just refer to expressions to
inspect them [requires x $expr] c) can't do multiline commands d) ^D
doesn't produce a tidy exit

Arguably this is a function of perl not really having a first class
interactive shell. Either way a proper shell is a really useful
feature of many other languages that I've always felt was a major lack
in perl. Having a shell to do ad-hoc experiments with makes learning a
language much easier IME.

(Of course someone's going to show how perl 5.x actually does have
this and I've been living in cave the last $embarrassing_num years


More information about the london.pm mailing list