Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is all explained very nicely in <a href="http://wiki.ecmascript.org/lib/exe/fetch.php?id=es3.1%3Aes3.1_proposal_working_draft&amp;cache=cache&amp;media=es3.1%3arationale_for_es3_1_static_object_methodsaug26.pdf">"Proposed ECMAScript 3.1 Static Object Functions: Use Cases and Rationale" document</a> (pdf) by Allen Wirfs-Brock himself (editor of ES5 spec, and a member of TC39).</p> <p>I would suggest to read all of it. It's pretty short, easily digestible, and gives a nice glimpse of the thought process behind these ES5 additions.</p> <p>But to quote relevant section (emphasis mine):</p> <blockquote> <p>A number of <strong>alternatives API designs were considered</strong> before the proposed API was chosen. In the course of considering alternatives we developed a set of informal guidelines that we applied when considering the alternatives. These guidelines are:</p> <ul> <li>Cleanly <strong>separate the meta and application layers</strong>.</li> <li>Try to minimize the API surface area (i.e., the number of methods and the complexity of their arguments).</li> <li>Focus on usability in naming and parameter design.</li> <li>Try to repeatedly apply basic elements of a design.</li> <li>If possible, enable programmers or implementations to statically optimize uses of the API.</li> </ul> <p>[...]</p> <p>Here are some of the alternatives that were considered that lead to the selected design.</p> <p>The obvious initial idea, following the example of the already existing standard method Object.prototype.propertyIsEnumerable, was to add additional “propertyIs...” query methods on Object.prototype for the other attributes and a parallel set of attribute changing methods.</p> <p>[...]</p> <p>As we considered this approach there were a number of things about it that we didn’t like and that seemed contrary to the above API design guidelines:</p> <ul> <li>It <strong>merges rather than separates the meta and application layers</strong>. As methods on Object.prototype the <strong>methods would be part of the public interface of every application object</strong> in a program. As such, they need to be understood by every developer, not just library designers.</li> </ul> <p>[...]</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload