[plt-scheme] 370.3

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Jun 8 04:06:39 EDT 2007

MzScheme and MrEd are now version 370.3 in the SVN repository trunk.

Changes:

 * Added `hash-table-iterate-{first,next,key,value}', which makes it
   easier to implement iterators/generators for hash tables.

 * The bytecode optimizer provides better dead-code elimination for
   `letrec' and for unused chains of procedures (e.g., an unused `f'
   that has the only reference to `g' that has the only reference to
   `h').

In particular, the optimizer now handles all of the examples from

  http://www.cs.brown.edu/pipermail/plt-scheme/2007-April/017156.html

The one that remains is

 (comp=? (compile '(let* ([x 8][f (lambda () (set! x 5))]) 
                     (display x)))
         (compile '(display 8)))
 ; => #f
 ;  because the `set!' prevents constant propagation `x', even though
 ;  the `set!' is eventually removed

because mutability is still determined early. But mutability doesn't
necessarily interfere with dead-code elimination, so `foo' in the
second original example of the thread is eliminated:

  (letrec ((foo (lambda () ... (set! foo ...) ...)))
    ;; doesn't use foo:
    body ...)

This optimizer change is unlikely to speed up existing code, but it
gives macro writers their rights.

Matthew



Posted on the users mailing list.