some errata in PDF

Garrett Smith dhtmlkitchen at
Sun Aug 26 00:37:19 PDT 2007

On 8/25/07, liorean <liorean at> wrote:
> On 26/08/07, Garrett Smith <dhtmlkitchen at> wrote:
> > Missing:
> > Function.prototype.caller
> Should this property really be on the prototype?

It's useful for two cases:
1. Debugging
2. enforcing an entry point to a constructor.

The second use case is useful when trying to enforce a private
constructor by making a runtime check to the calling function. The
perfectly valid use case of trying to have a private constructor, will
not, unfortunately be accommodated by ES4; the ugly run-time approach
or the module pattern will not be ameliorated.

Regarding access-modified constructors, ES4, Section 9.6.1 states:
"While other languages allow constructors methods (grammar error not
mine) to be inaccessible to keep outside code from creating instances,
this use case was not deemed important enough to complicate the
language design."

However, enforcing a singleton has lead to strangeness such as runtime
checking of the caller (case#2 above) and the "module pattern".

Back to "caller"...
"caller" is on the prototype in Mozilla. Not sure where it is in IE,
prototype or instance.

On the instance in WebKit.

Absent in Opera.

> the Function instances alone seems a bad idea to me, since the value
> is per call and not per function object. But placing it on the
> Function prototype seems an even worse idea. It should really be a
> property on the function object only for compatibility reasons in
> engines which have to use it (and even then only exist while the
> function is executing).
> > ?
> Makes more sense - the Function prototype is a function per ES3, so if
> function instances should have a name property, then the Function
> property should probably have it as well. IIRC ES3 doesn't specify it,
> but it's in the browser hosted engines.
> --
> David "liorean" Andersson
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at


More information about the Es4-discuss mailing list