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

Re: Python or Perl for a Debian maintainance project?

On Sat, Feb 21, 2004 at 10:13:42PM +0100, Matthias Urlichs wrote:
> Hi, Andrew Suffield wrote:
> >> Files, for instance, are objects in Perl. Except when they're GLOBs,
> >> wait, OK, except when they're references to GLOBs.  :-P  There's no sane
> >> way (one or two less-than-sane ones, though) to write a program which
> >> accepts all three of these.
> > 
> > It's your own stupid fault if you use typeglobbed filehandles; there's no
> > reason for it.
> > 
> I'd say that it's the language designer's fault to offer three
> incompatible implementations of "file". There's no reason for it.

There is precisely one very good reason for it: backwards

> I know, Perl's very mantra is that there's more than one way to do it
> and now my part of the program and yours need to work together. Ugh.

"Oops, we forgot to agree on an API before we started".

That's even stupider, and it's still your fault.

> >> 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.
> > 
> > $a->fileno == $b->fileno
> Thank you for proving my point. I _said_ "string-used-as-a-file".

Then your question has a type error. An IO::File and an IO::Scalar
can't possibly refer to the same fd. Comparing these kinds of objects
doesn't make any sense.

> >> Arrays and hashes are not objects.
> >Why should they be?
> Because you'd want to subclass them by attaching methods, or some other
> sort of attribute to them?

You can do that anyway (with bless) and they still aren't objects.

> >And making numbers objects is a dumb idea
> Proof by assertion? 
> Speaking of dumb ideas, I could say, with at least equal justification,
> that Perl's principle of implicitly treating strings like numbers and vice
> versa is WAY more stupid, because it directly causes dumb programmer
> mistakes.  I'm sure (based on your other statements in this thread) that
> _you_ never use != when you compare strings in Perl, but others either
> aren't as lucky, or decided to use programming languages where that
> mistake cannot happen in the first place.

You get a perfectly good warning thrown if you do this. That's the
best you will ever get in a weakly typed language. Only a strongly
typed language can trap these kinds of errors.

Perl is forgiving of non-fatal errors and doesn't run around killing
programs for something recoverable like this. Doing that would be bad
for application stability.

> >The point of tie is to make objects look like non-objects. Not the other
> >way around. You seem to have missed that point.
> No I didn't. The point was that if they were all objects, you wouldn't
> need the silly tie() in the first place.

Then you wouldn't be able to treat them as non-objects, which is
usually something you really want to do.

> >> Perl doesn't have class variables,
> >
> >Don't be silly, of course it does. It's just a lexical in the class
> >package.
> ... except that it's not inheritable and you can't easily refer to it from
> outside the class, given an object. Some other languages don't share these
> problems.

Those restrictions are normal for "class variables" (aka statics). You
probably want to use fields instead, or maybe a package global and
Exporter, or maybe a method that returns an object. Perl doesn't share
these problems either.

> >Classes are a design feature. Not an implementation feature. Define what
> >it means for a language to "have classes", and justify why anybody should
> >care about that definition.
> As a programmer, I could care less about definitions. I care about whether
> the way I want to code is a subset of the list of features the language
> offers, and how nonintuitive the resulting code looks when I need to
> implement workarounds for the features it doesn't offer.

It appears that the problem is simply that you don't know how to use
the features it does offer, and therefore assume it does not.

  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature

Reply to: