{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/13","repository_url":"https://api.github.com/repos/tc39/proposal-class-fields","labels_url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/13/comments","events_url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/13/events","html_url":"https://github.com/tc39/proposal-class-fields/issues/13","id":240467557,"number":13,"title":"How should initializers as functions interact with any stack trace/debugger API?","user":{"login":"littledan","id":189835,"avatar_url":"https://avatars0.githubusercontent.com/u/189835?v=3","gravatar_id":"","url":"https://api.github.com/users/littledan","html_url":"https://github.com/littledan","followers_url":"https://api.github.com/users/littledan/followers","following_url":"https://api.github.com/users/littledan/following{/other_user}","gists_url":"https://api.github.com/users/littledan/gists{/gist_id}","starred_url":"https://api.github.com/users/littledan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/littledan/subscriptions","organizations_url":"https://api.github.com/users/littledan/orgs","repos_url":"https://api.github.com/users/littledan/repos","events_url":"https://api.github.com/users/littledan/events{/privacy}","received_events_url":"https://api.github.com/users/littledan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-07-04T16:52:39Z","updated_at":"2017-07-06T23:25:37Z","closed_at":null,"body":"@bmeurer raised the question, if initializers are specified as methods, will this have runtime overhead? It would be nice if frontends could trivially inline initializers in the normal case. There are a few ways that this might be observable, though none of them are in the ECMAScript specification:\r\n\r\n- In `function.caller`: This one doesn't actually come up, since the entire class body is in strict mode. As a result, referring to the caller will throw (or sometimes return `null` in V8), even if it's calling out to sloppy mode code outside of the class body. It would never reveal the initializer method.\r\n- In the stack traces: I'm not sure whether or not initializers should show up separately in stack traces from the constructor (or wherever else super is called from). I'm guessing maybe they should, as they're not organized linearly, and having both pieces of information (where the constructor starts/super is called, and which line of code the initializer is on) are separately useful.\r\n- In introspective stack trace APIs: I have not looked across multiple engines, but it seems like in V8, getting the actual function identity from a stack trace is only available for sloppy mode code, and not strict mode code. This seems to mean that we would never leak the function for the initializer, even through the stack trace API.\r\n\r\nUltimately, it's a non-normative choice whether we use a method for initializers or fashion the scope in a more direct way. Methods are used in the current spec text to minimize the diversity of representations of scopes, to keep things analogous to other code, and to reduce the amount of spec machinery. But earlier drafts fashioned the scopes more directly. I'd be fine to switch back if it would be helpful.\r\n\r\ncc @bmeurer @jaro-sevcik @bterlson @syg @kmiller68 @xanlpz @ajklein"},"comment":{"url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/comments/313546123","html_url":"https://github.com/tc39/proposal-class-fields/issues/13#issuecomment-313546123","issue_url":"https://api.github.com/repos/tc39/proposal-class-fields/issues/13","id":313546123,"user":{"login":"ajklein","id":1571484,"avatar_url":"https://avatars1.githubusercontent.com/u/1571484?v=3","gravatar_id":"","url":"https://api.github.com/users/ajklein","html_url":"https://github.com/ajklein","followers_url":"https://api.github.com/users/ajklein/followers","following_url":"https://api.github.com/users/ajklein/following{/other_user}","gists_url":"https://api.github.com/users/ajklein/gists{/gist_id}","starred_url":"https://api.github.com/users/ajklein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajklein/subscriptions","organizations_url":"https://api.github.com/users/ajklein/orgs","repos_url":"https://api.github.com/users/ajklein/repos","events_url":"https://api.github.com/users/ajklein/events{/privacy}","received_events_url":"https://api.github.com/users/ajklein/received_events","type":"User","site_admin":false},"created_at":"2017-07-06T23:25:37Z","updated_at":"2017-07-06T23:25:37Z","body":"The fact about decorators seem orthogonal to the question of how to spec these things for now. That is, if it turns out to be bad for performance to leak these methods, then that's a problem with decorators, not a problem with class field initializers."}}
{"actor":{"display_login":"ajklein"}}