Ticket #441 (closed enhancement: invalid)

Opened 2 years ago

Last modified 2 years ago

Do we need two ways to specify getter/setters (in 11.1.5 and 15.2.3.5)

Reported by: pratapl Assigned to: anonymous
Type: enhancement Priority: major
Component: Proposals Version: 3.1
Keywords: Cc:

Description

<script>
// Syntax 1
// the below syntax is supported in the latest versions of FF, Safari and Opera
var o1 = {
           get foo() { return 45; }
         };
// alert(o1.foo); => 45
</script>
<script>
// Syntax 2
// the ES3.1 alternative
var o2 = Object.create(
             p,       // where 'p' is the prototype
             {
                 foo : {
                     getter : function () { return 45; }
                 }
             }
          );
// alert(o2.foo); => 45
</script>

Should we standardize syntax 1, when we are standardizing syntax 2?

Attachments

Change History

Changed 2 years ago by allen

Yes, these are distinct things. One is and extension to object literals, the other is part of the relection API. The object literal form is what should be used in most simple scenarios but if you want full control of property attribues you need to use the reflection API.

Finally, 3/4 browser already support the object literal form

Changed 2 years ago by David-Sarah Hopwood

  • status changed from new to closed
  • resolution set to invalid

Agreed, closing as invalid.

Note: See TracTickets for help on using tickets.