> Does this work even when side-effects to dynamically-bound variables are> allowed, e.g.

This should be closely related to how ML would handle side-effects to
variables. I'm not really sure how this happens (haven't done type
inference for non-functional languages).

The problems of type inference for Lisp are actually quite a bit more
complex. You could probably do something like what Alex Aiken and I
did for FL (described pretty abstractly in our POPL paper which will
be presented next week, Type Inference in a Typeless Language, in more
detail in my 1990 MIT MS thesis). The mechanism we used should be
fairly easily extensible to variable side-effecting, but would suffer
from terrible performance problems without further improvements.

Does anyone know a reference for how ML handles side-effects to variables?