Implement the Function implementation hiding proposal

NEW
Unassigned

Status

()

enhancement
P3
normal
5 months ago
2 months ago

People

(Reporter: alex.fdm, Unassigned)

Tracking

(Blocks 1 bug, {dev-doc-needed})

63 Branch
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

()

Reporter

Description

5 months ago

The proposal is currently in Stage 2.

Priority: -- → P3

Thoughts:

  1. It seems to me the motivation for this proposal is unusually weak, even for TC39.

    • The main justification for this is Angular abusing Function.prototype.toString. But the feature does not actually address that problem. It just puts a "break Angular" directive into the language. Maybe it should be called "punish the impure";. Or "use no evil";. :P

    • Also mentioned: Two polyfill authors have developed workarounds to trick _.isNative(). But we shouldn't add features to JS for the benefit of those two people, especially since they already have a way to fool _.isNative that works. So what problem is this solving, again?

  2. Setting aside the behavior change, developers (and compile-to-JS folks) will be interested in memory savings and that is probably the main reason (if any) they'll want to use this. But we currently retain source code on a per-script basis, not per-function, so if we implement this in the obvious way, they won't actually save any memory when using this directive in a function prologue.

  3. If we do in fact discard source, it would affect the debugger. Quality-of-life thing, but the devtools team will want to think about this, if this proposal sticks.

Reporter

Updated

2 months ago
Summary: Implement the Function.prototype.toString() censorship proposal → Implement the Function implementation hiding proposal
Reporter

Comment 2

2 months ago

The proposal is now called "Function implementation hiding", updating the bug title and link accordingly.

You need to log in before you can comment on or make changes to this bug.