[PRL] Bob Harper's new blog
Matthias Felleisen
matthias at ccs.neu.edu
Thu Mar 17 12:27:27 EDT 2011
[I am with Dave, I have read his reply.]
On Mar 17, 2011, at 11:44 AM, will at ccs.neu.edu wrote:
>
> In current OO languages, loops are expressed without using calls.
I don't understand this reason.
> The OO culture continues to emphasize inheritance, which has the
> effect of deprecating static, final, and private methods that
> can't be overridden in a subclass.
This is just an expansion of Bob's point. For the record, this
also contains a good dose of irony. One reason OO design patterns
push inheritance here is to help the type checker find errors before
you run the program -- see Blue Book. Bob should *like* this.
[a bit out of order]
> In most programs that are written in mostly-functional languages,
> well over 90% of the procedure calls are made to functions whose
> code could be determined at compile time.
> Most of the currently available OO compilers don't even try to
> determine the target of a dynamic method call, mainly because
> the mere possibility of inheritance usually defeats that kind
> of optimization.
Now we're getting to the heart of the issue. I doubt we know
enough here to evaluate this point:
1. I am told that several of Sun's compilers do a good job
determining the target of dynamic method calls. Indeed, in
certain conference circles the argument goes like this:
-- FP is bad because they can't analyze method calls target
as precisely as we can
-- our type system gives us a stepping point that helps
program analysis more than FP compilers
I find this equally wrong and challenge it when I hear it.
2. I am also told that OO programmers actually don't use
inheritance enough (from an SE perspective) and that the
use of inheritance is tolerable. That's from academic
compiler guys who parallelize for a living. Perhaps the
problem is 'academic' in that sentence.
3. The final question is of course
if you are correct, is it just a question of
finding the right kind of analysis for OOPLs?
For all we know a 'applicative' OOPL could be equipped with the
same kind of analysis an FPL has to compute call targets. Perhaps
this is a worthwhile research topic and -- if successful --
would help promote 'applicative' programming and -- if a failure --
would scientifically establish the inferiority of a certain class
of OOPLs.
Either way it sounds like a worthwhile exercise for scientists.
Warning: purely social conventions will probably ensure that this
research is irrelevant for the future of compilers.
-- Matthias
More information about the PRL
mailing list