Ticket #10 (closed feature: wontfix)

Opened 2 years ago

Last modified 1 year ago

Where does C.prototype.constructor.name get set?

Reported by: lth Assigned to: brendan
Type: feature Priority: major
Milestone: M1 Component: Proposals
Version: 4 Keywords:
Cc:

Attachments

Change History

Changed 2 years ago by jeffdyer

  • owner set to edwsmith

Question: function instances do not have 'name' in ES3, so what is 'C.p.c.name'?

Changed 2 years ago by jeffdyer

Response from Ed:

Good question. I don't see it being set in AS3 at all. The closest approximation I can think of is a name instance property on class Class that is (static) inherited into each concrete class (Object, Function, etc).

If it isn't a property of Function so (function(){}).p.c.name is simply not defined.

I think the reason we don't have Class.name in as3 is static inheritance would make "name" defined in basically every method of every class and be surprising. Although it should be easily hidden by your own static or instance or local "name" property.

Ed

Changed 2 years ago by jeffdyer

  • owner changed from edwsmith to brendan

I think the original question is for Brendan. Rephrasing: why do SM function instances have a 'name' property? This may be NAB.

Transferring to brendan.

Changed 2 years ago by brendan

This bug came from fcheng's issue-scraping, so it may be easily resolved as "deferred" or "wontfix" or whatever.

There are two issues I see:

1. Should the SpiderMonkey? (and Rhino?) 'name' instance of Function.prototype be made available in ES4?

2. Should there be a class name reflection as a static property, called 'name' or something appropriate?

We should talk about 1, but it's not essential for ES4. Comments in this ticket are welcome.

I think the meta objects proposal addresses 2 better than adding a static class name reflection.

/be

Changed 2 years ago by brendan

  • milestone changed from M0 to M1

M1 to give us time to talk about fun.name.

/be

Changed 1 year ago by lth

The meta-objects proposal gives us:

  typeOf(C.prototype.constructor).name()

which frankly is not a hardship, so I move we close this as WONTFIX.

Changed 1 year ago by brendan

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

Agreed, the meta_objects shows the way.

/be

Note: See TracTickets for help on using tickets.