some errata in PDF
liorean at gmail.com
Sun Aug 26 06:44:59 PDT 2007
> > On 26/08/07, Garrett Smith <dhtmlkitchen at gmail.com> wrote:
> > > Missing:
> > > Function.prototype.caller
> On 8/25/07, liorean <liorean at gmail.com> wrote:
> > Should this property really be on the prototype?
On 26/08/07, Garrett Smith <dhtmlkitchen at gmail.com> wrote:
> It's useful for two cases:
> 1. Debugging
> 2. enforcing an entry point to a constructor.
Neither of these cases seems to have anything at all to do with the
prototype, if you ask me. I don't see why you would ever want to
access the caller property on the prototype. The property is not
useful for the prototype itself (which is a function of zero formal
parameters with an empty function body returning nothing) since the
only case you could access it is from a called function, and the
prototype having an empty function body means it does not access it
when called, so there is absolutely no need for it. Nor would it be
useful for function instances to delegate to the prototype, since the
value is only interesting per instance. Even further, it's not really
appropriate to have it on the function object of instances at all,
since it only makes sense when the function has been called, i.e. in
the function body itself.
A much more sensible place to put it is on the arguments object, since
that is per instance, per call. Having it on the function object at
all is itself simply bad design coming from Netscape's hurried
implementation. It being accessible through the function object is a
language wart, plain and simple.
David "liorean" Andersson
More information about the Es4-discuss