[PRL] MSFT gives Joe Marshall kudos,
decides Appel was right after all
Matthias Felleisen
matthias at ccs.neu.edu
Fri Jun 2 16:31:58 EDT 2006
On Jun 2, 2006, at 3:22 PM, Dave Herman wrote:
>> The problem is not the stack, per se; it's the bogus notion that you
>> push on entry and pop on exit.
>
> Ryan and Will have helped beat this assumption out of my brain by now
> (oh, the years of C-induced brain damage...) but I'm not sure I
> appreciate its gravity.
>
> Certainly, leaf procedures may account for a huge percentage of an
> execution trace, and many/all of those leaf procedures may not require
> a stack frame. So I can see how this would be a big efficiency gain.
> But is it just a "God, implementors are wasteful" point, or is there
> some deeper (say, semantic) reason why this is significant?
>
> Maybe I can actually answer my own question: some language definitions
> *depend* on this assumption; for example, ECMAScript specifies an
> "activation object" that exists during the execution of a procedure
> body, with certain observations you can perform on that object. This
> makes it hard for an implementation not to push on entry.
>
> But this still has the feeling of enabling/thwarting a compiler
> optimization, as opposed to proper tail recursion, which actually
> significantly affects the way people write programs.
>
> More succinctly: does the push-on-entry assumption affect the way
> people write programs?
YES. Tail-call optimizations is a HORRIBLE name for this important
principle, especially if you want to stick to FP or OOP principles.
It's all about program design, and nothing else.
-- Matthias
More information about the PRL
mailing list