[gclist] Finalization and object orientation.

Henry G. Baker hbaker@netcom.com
Tue, 1 Apr 1997 19:26:27 -0800 (PST)


Guillermo:
> But there are other options.
> 
> Option 1: Use tail-recursion to get rid of intermediates.  This is
> essentially what a CPS compiler does for you, but automatically.
> However, you have the choice to do it or not.
> 
> Option 2: Explicitly clear the variables when appropriate.  In ML you
> would have to bind the variables to cells (I think you guys call them
> "refs", but I don't recall).  Again, the choice is left to the programmer.

Non-functional.  Ugly.  Go back to #1 by using 'let' more cleverly.

> The problem that I see with _requiring_ this behavior (I've
> implemented compilers that provide it and others that do not) is that
> it has too much of the flavor of "semantics defined by the art of
> compiler optimization".
> 
> I'd much rather have a simpler notion that even a novice could follow
> and understand as the requirement.

Impossible, in general.  Variable 'typing' is essentially producing a
homomorphic image of a program, and trying to make sense of the image.
You could do some of the same thing with computer time & space, but
the halting problem guarantees that a _decidable_ typing scheme will
be very 'loose'.  Look at the tremendous pressure on computer
architects to make machines 'fast' rather than 'predictable'.  I
suspect you will eventually find the same pressures to make programs
'small' rather than 'predictable'.

When your plane is falling out of the sky due to a glitch in the cache
management scheme or the Ethernet backoff mechanism or the DRAM
refresh cycle, you can comfort yourself with the tremendous number of
cycles that must have been saved on _average_.

-- 
Henry Baker
www/ftp directory URL:
ftp://ftp.netcom.com/pub/hb/hbaker/home.html