John Cowan wrote:

> If anyone actually exploits this R6RS innovation, I still hope to hear
> of it.

The innovation allows Scheme compilers to use eta conversion
for all procedures, without having to distinguish between
procedures that were introduced by the compiler or are the
value of compiler-generated temporary variables from
procedures that are the values of variables that appear in
the original code.  With the R5RS semantics, sophisticated
compilers had to include that extra complexity.  Simpler
compilers either avoided eta conversion, limited their
optimizations to avoid using eta conversion in problematic
situations, or ignored that detail of the R5RS semantics.

In Larceny, for example, the compiler's lambda lifting and
closure conversion optimizations apply only to procedures
that are either anonymous or used in first order fashion.
If you name a procedure and pass that procedure as an
argument to another procedure, that procedure will not be
optimized by Larceny.  With eta conversion allowed by the
R6RS semantics, Larceny's optimizations would not have to
be restricted to first order procedures.

I don't think Larceny takes advantage yet, but Larceny is
an R5RS/R6RS implementation.  If the R7RS were to allow eta
conversion, so Larceny would no longer have to support R5RS
semantics, then Larceny would do a better job of optimizing
higher order procedures.

PC Scheme definitely used eta conversion, to solve exactly
the same problems that limit Larceny's optimization to first
order programs.  The PC Scheme compiler may not have been
strictly legal (it was pre-R5RS, and I'm not going to bother
to look up the relevant standards of its time), but there
are some programmers who value performance more than
Spanky-level conformance to some committee's arbitrary
decisions.

I don't know whether any of the other R6RS implementors have
yet taken advantage of the eta rule.  Chez Scheme and Racket
are the most likely implementations to have done so, but
you'd have to ask Kent Dybvig and Matthew Flatt.  (I suspect
that typed Racket and contracts rely on eta conversion, but
those languages are not limited by R5RS or R6RS semantics.)

Will

_______________________________________________
r6rs-discuss mailing list
r6rs-discuss@lists.r6rs.org
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to