proper tail calls

Brendan Eich brendan at mozilla.org
Tue Jan 22 11:02:10 PST 2008


On Jan 22, 2008, at 7:45 AM, Neil Mix wrote:

>>> Thanks. That would work. But I can still see the "average" user  
>>> being
>>> confused when debugging, and not knowing what is going on.
>>
>> Would you think an explicit keyword syntax for mandatory tail call
>> would help such a user?
>
> I do.

Others argue that this syntactic penalty box means no one will use  
PTC; the cursed view of tail calls and recursion will not fade away.

>> My point is that debugging is a specialized task with immature
>> (frozen in the last days of disco!) tools; the debugger tail should
>> not wag the dog.
>
> I can't argue the sentiment.  But exactly how soon will such advanced
> debugging tools be generally available and in the hands of the
> programmers we're discussing?  Before ES4 has given way to ES5/6/7?

Dave followed up, but I wanted to point out that adapting Firebug and  
the JS Debugger API it sits on to have a bounded queue of frames, and  
turn this overhead on only when debugging, is not going to take long  
to hack, or tie up all your machine resources -- not on modern fat  
desktops.

Anyway, dog before tail.

>> Separately, poring over crashdumps (which is not the same as
>> debugging, and not a task for "average" users), many C++ hackers have
>> had to deal with good old "TCO". It's a pain, but we keep the
>> optimization levels high for production builds and suffer the  
>> entrail-
>> reading horror when investigating crashes.
>
> Without forcing you to declare your age ;) I must point out that it's
> common these days for programmers to have over a decade's experience
> without any coredump debugging experience.  (I'm *almost* an example
> of this.)  I'm having a hard time swallowing the argument that it's
> OK for a modern language like ES4 to require the skillsets used for
> assembly++.

No, you misread me (and yes, I'm old).  Hard cases make bad law, they  
teach in law school. The hard case I cite is probably not a common  
one that "average users" will face, even if implicit PTCs are common  
in ES4.

> I think that's skewing the sample.  We're not talking about schemers
> here, we're talking about scripters.  They don't read language specs,
> they use tutorials and references, and they just so happen to vastly
> outnumber the people on this list.

The testimony I'm thinking of, and you can find it in that LtU thread  
I'm tired of citing (but it could use more detailed and colorful  
anecdotes) suggests that debugger drivers don't often go back up the  
stack to find overwritten frames' variables. Or something like that  
-- I need backup here.

And if not, the queue stands ready. I'm not being glib. I really do  
think debuggers should not distort the design too much.

> I think the implicit-hurts-debugability argument has a lot more
> weight than you're giving it, especially in the near-term.

You are with Waldemar then, and this is one of those axes of  
disagreement. I just find it hard to believe it's the decisive high- 
order one.

/be



More information about the Es4-discuss mailing list