Front page | perl.perl6.language |
Postings from June 2001
Re: Properties and stricture
From: Daniel S. Wilkerson
June 5, 2001 08:22
Re: Properties and stricture
Message ID: 3B1CF9AF.5C97D980@digital-integrity.com
I would like to suggest that this is one of the major advantages that Java
has over Perl. Getting things to "work" quickly in Perl is great. I like
that very much about Perl. But in the end, I'm most concerned that my code
is correct. Having the compiler check everything it can possibly check for
me is really a requirement for that. You shouldn't find out at run time
that you "fell out" of some part of a complicated data structure. This is
one of the major problems with LISP (besides other things, like being hard
to read.) With Java, if you build a huge complex data structure, at
*compile* time you know that none of your complex manipulations of it "fall
out", you didn't get confused and ask for the foo member of a bar when only
gronk's have a foo. Compile time type checking of method signatures is
really helpful as well. It got to the point in Java that I would sometimes
check in my code without even testing it I was so sure it was correct.
I can't imagine ever saying that about Perl.
I would like to be able to use Perl for serious large-scale
industrial-strength object-oriented projects, but the lack of strong
compile-time type checking really prevents it, unfortunately. Larry, if
you're out there, I would say this is *the* major thing you could fix in
Perl 6, if I may be so bold. Maybe you could allow people to progressively
turn on more and more checking, so you could develop things in the Perl we
have now, but after you were done turning on all the checking, it would be
as strict as Java. In fact, make it better than Java, why not?
P.S. I'm really not interested in any flames about Java, LISP, etc.
Comparative criticisms across languages are a major way to get ideas for
new improvements, which is the point of this list, as far as I can tell.
> On Mon, Jun 04, 2001 at 06:49:28PM -0500, Me wrote:
> > Afaict, even with use strict at its most strict, perl 6
> > can't (in practice) complain, at compile time, if
> > $foo.Foun
> > refers to an undeclared Foun.
> > Right?
> > Should there be a strict mode that warns if a
> > method name matches a built in property name?
> Could have one that requires all inheritance and variable declarations
> occur at compile-time, but that will only effect your current scope.
> Won't help against classes you inherit from doing run-time things.
> And then there's autoloading...
> There's also the problem of knowing at compile time what class/type
> $foo is. Don't know what's going on with that just yet, do we?
> So I'd say no, Perl can't know at compile-time if your method is
> declared or not. Only in certain restricted cases, such as if you
> don't inherit from anything, or if *all* your parent classes are
> declared strictly.