Ye olde arguments argument (was: Topic list - pending changes and issues for the ES3.1 spec)

Garrett Smith dhtmlkitchen at
Wed Sep 17 00:07:08 PDT 2008

On Sun, Sep 14, 2008 at 12:30 PM, Mark S. Miller <erights at> wrote:
> On Sun, Sep 14, 2008 at 11:09 AM, liorean <liorean at> wrote:
>>> El 13/09/2008, a las 2:08, Brendan Eich escribió:
>>>> I hold no brief for callee.
>> 2008/9/14 Jorge Chamorro <jorge at>:
>>> Where can I learn what's wrong with arguments.callee, what's the
>>> reason why you all want to get rid of it... ?
>>> TIA
> The arguments object itself is often passed in order for function F to
> give function G access to the argument list F with which was called.
> This seemingly innocent operation should not also inadvertently
> provide G with the ability to call F. F might otherwise be
> encapsulated within some larger abstraction.

I don't see why that is a problem. A defensive copy is enough, no?

> After ES3.1, I think I like the idea of providing stack trace
> information in a standardized way on Error objects. Anyone care to
> make a proposal?

Mozilla has a string value for error.stack.  This value is only added
to an actual Error instance, not any other object.  The stack property
is added when it is thrown.

 throwIt(o):  "no stack"
 throwIt(new Error): "stack"

var o = {name: "Custom", message : "My message."};
function throwIt(it) {
  try {
    throw it;
  } catch(ex) {
    return ex.stack ? "stack" : "no stack";

Instead, it would be more useful for all thrown objects to get a stack
property, unless the object already had one.

Test runners should provide a stack to make finding bugs easier.
Therefore, a custom error should also get a stack property, unless it
already has one (a test framework might be saving a stack, then

It might also be useful to have the Error constructor accept an Error
(for rethrowing).

Error (error)
  If the argument error is an object, the newly constructed
  object has a message property of the Error's message, and
  a stack property of the error's stack (if it is not undefined).

If an error is rethrown, it won't get a new stack property.



> --
>    Cheers,
>    --MarkM

More information about the Es-discuss mailing list