Ticket #84 (new defect)

Opened 2 years ago

Last modified 1 year ago

A standard "length" property on classes?

Reported by: lth Assigned to: lth
Type: defect Priority: major
Milestone: M1 Component: RefImpl
Version: 4 Keywords:
Cc: brendan, jeffdyer, edwsmith

Description

The builtin classes all require a length field that signifies the number of required arguments of their respective constructor functions. Currently this field is not created by the RI, nor is it present in the class definitions in the builtins/ directory. Either would be possible.

  • Should all classes have a length field, or just the builtins?

Attachments

Change History

Changed 2 years ago by lth

  • cc changed from brendan, jeffdyer to brendan, jeffdyer, edwsmith

Ed, can you comment?

Changed 1 year ago by _Sam_

Isn't "length" too generic for this specific purpose? Something like "constructorArgumentsLength" would be better--it's really long but the property has a single very-specific purpose and wouldn't be used very often. Besides, won't "length" interfere with a lot of pre-existing classes?

Changed 1 year ago by lth

The "length" property would be on the class object, not on instances, so I doubt it would be a big deal, compatibility-wise -- and ES3 doesn't have classes, so any compatibility problems would be vs ActionScript? or JScript.NET. All the builtin classes already have a "length" property (courtesy of 3rd Ed).

That said, perhaps it's time to deprecate this particular feature and just special-case the builtins.

Changed 1 year ago by lth

See also #203.

Changed 1 year ago by lth

  • owner set to lth
  • component changed from Proposals to RefImpl

Agreement: we add a "length" property to the class object iff it has a "meta static function invoke" method.

Changed 1 year ago by brendan

Just to clarify (for myself): the resolution is to automatically predefine length for all classes containing meta static function invoke.

/be

Note: See TracTickets for help on using tickets.