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

RE: Python or Perl for a Debian maintainance project?

Matthias Urlichs wrote:
> Julian Mehnle wrote:
> > Steve Greenland wrote:
> > > to describe Perl's OOP system as anything except "kludgy and
> > > fragile" is wishful thinking.
> > 
> > I've read that multiple times now.  Unless I do have some reading
> > problem, I haven't seen any founded justification for that
> > assessment, though. 
> Files, for instance, are objects in Perl. Except when they're GLOBs,
> wait, OK, except when they're references to GLOBs.  :-P

use IO::Handle, then all file handles are objects:

| gray:~> perl -MIO::Handle -e 'STDOUT->print($_->fileno, "\n") foreach STDIN, STDOUT, STDERR;'
| 0
| 1
| 2

This also invalidates your next statement:

> There's no sane way (one or two less-than-sane ones, though) to write a
> program which accepts all three of these. There's no sensible way to
> figure out whether file-thing A and file-thing B refer to the same file
> descriptor / string-used-as-a-file / whatever.

Sure there is.  See above and what Andrew wrote.

> Perl doesn't have class variables, or instance methods.

You must have a serious misconception here.  Please tell us your definitions of "class variable" and "instance method".

> In fact you can argue that Perl doesn't have classes anyway; it's more
> like "a reference to something which is stamped with a package name,
> which is where functions are looked up if you pretend that you want to
> call a method".

So what?  Define "class".

> (Yeah, of course Python has none of these problems, yadda yadda yadda
> ;-) 

Perl's OO model in many regards is much more flexible than that of other OO languages.  The syntax might not be as "nice", and there's no "nice" way to declare parameter lists for subs (i.e. methods) in Perl 5, but that's about it.  I don't see any *real* problems.

Reply to: