-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editorial: Minimize use of the term "callable" #2889
base: main
Are you sure you want to change the base?
Conversation
I think this is a lot of churn for not a lot of benefit - and this change would be problematic if we ever are able to fix the mess that is [[Call]] vs [[Construct]] in the spec - iow, imo things that you can't invoke without |
Yeah, if that ever happens then this PR would probably be mostly churn. Is it likely to happen? I don't see a proposal for it. |
It’s not necessarily normative, and no, there’s nothing pending. I’m also saying i think it’s churn as-is - proxies aren’t functions but can be callable, as is document.all. |
So you're saying there are currently things that are callable but that aren't functions. That's interesting. What is your definition of 'callable'? (or maybe, what's your definition of 'function'?) It looks to me like callable proxies and document.all are objects that support the |
If i can’t Function.prototype.toString.call it, it’s not a function, regardless of what typeof says. |
You can Function.prototype.toString.call both a Proxy for a function and |
ha, fair enough then. i still don’t think this PR’s churn is worth it, personally. |
Discussed at the editor call today. We're going to explore the viability of removing always-throwing |
@michaelficarra is there somewhere one could learn more about that / see the discussion? |
Re: churn, outside ES repos it looks like IsCallable is used by at least the following specs & proposals: HTML also CSS Layout API Level 1, but it looks like it’s not used in the real(?) spec (“lasted editor’s draft” in w3c parlance), just its commit history (“latest published version”). It’s also a term that’s made its way into userland JS a good amount, I think, but I suppose that wouldn’t have much bearing. A bit sad to see it go myself but admittedly can offer no explanation as to why :) Horrible thing 👻
It even “supports instanceof” with a simple shim. document.all(0).id = "prototype";
Object.create(document.all(0)) instanceof document.all; // true |
@bathos although https://npmjs.com/is-callable is usually a transitive dependency, the term definitely has some adoption. |
In the ECMAScript spec, the term "callable" (as a noun) is synonymous with "function", but that might not be obvious to the reader. (There are languages in which callables are a superset of functions.)
This PR mostly eliminates the word "callable". (I left a few occurrences, e.g. "a function is a callable object" is an informal way to relate concepts.)
The first commit just renames
IsCallable
toIsFunction
. The second commit handles other occurrences. They can probably be squashed for merging.