Ticket #7 (new feature)

Opened 2 years ago

Last modified 1 year ago

What is the type of C.prototype?

Reported by: lth Assigned to: lth
Type: feature Priority: major
Milestone: Component: Spec
Version: 4 Keywords:
Cc: graydon, brendan, jeffdyer

Description (last modified by fcheng) (diff)

C.prototype is not exactly the same type as an instance of C. Is it an implicit subclass?

Wiki location => proposals:builtin_classes

Related ticket: Ticket #10: Where does C.prototype.constructor.name get set?

Attachments

Change History

Changed 2 years ago by fcheng

  • description changed from C.prototype is not exactly the same type as an instance of C. Is it an implicit subclass? [https://intranet.mozilla.org/ECMA/wiki/doku.php?id=proposals:builtin_classes#open_issues Wiki location => proposals:builtin_classes] to C.prototype is not exactly the same type as an instance of C. Is it an implicit subclass? [https://intranet.mozilla.org/ECMA/wiki/doku.php?id=proposals:builtin_classes#open_issues Wiki location => proposals:builtin_classes] Related ticket: [http://www.es-lang.org/es4/bugs/ticket/10 Ticket #10: Where does C.prototype.constructor.name get set?]

Changed 2 years ago by jeffdyer

Dynamic type of C.prototype has the following characteristics:

* is dynamic * has prototype properties, but not intrinsics * has some magic behavior associated with its class

For this reason and others its not an Object, but not a C either.

Changed 2 years ago by jeffdyer

  • owner deleted
  • component changed from Proposals to RefImpl
  • milestone changed from M0 to M1

The magic behavior in the builtins can be implemented using static methods of the class. There is no apparent reason for why prototypes of user defined classes would normally have such magic, and if it did that behavior could be implemented in the same way as in the builtins.

Resolution: The dynamic type of C.prototype is Object.

s/Proposals/RefImpl/ s/M0/M1/

Changed 1 year ago by lth

  • cc set to graydon, brendan, jeffdyer
  • owner set to lth
  • component changed from RefImpl to Spec
  • milestone deleted

I don't think I understand the resolution. On other occasions we've said that the manifest type of the object that is the value of D.prototype is some class type D' which is like D except that:

  • D' is a dynamic class
  • D'.prototype has is a value whose manifest type is the same as that of B.prototype, where B is the base class of D.

The declared type of the prototype property in a class is probably Object, though, if that's what's meant here (but the word "dynamic" indicates something else is meant).

Changed 1 year ago by graydon

The RI still has a big pile of bugs that relate to this ticket. Do we have documented consensus elsewhere on the dynamic type of C.prototype?

Note: See TracTickets for help on using tickets.