Comments (9)
It seems a duplicate of #48 and #93, but any actions are missed for some years.
from es-abstract.
It is indeed a duplicate of both; no action will likely be taken for some decades, given that the real problem is the specification - class constructors are not actually callable, they just implement this with a [[Call]] slot that throws a type error. There’s no use case whatsoever for IsCallable returning true here just to throw later (since IsCallable checks basically always guard a Call).
Filing a redundant issue won’t get things moving any more than a comment on the actual issue would, fwiw.
from es-abstract.
In this case, positioning of es-abstract
as a proper set of ECMAScrpt spec abstract operations makes no sense.
from es-abstract.
This isn't a productive argument. es-abstract is ES AOs for use in polyfills. If you can find a bug in a polyfill caused by IsCallable returning false for a class constructor, I'd be happy to fix it, but if it's just changing when an error is called (because class constructors aren't callable) then it's perfectly reasonable to make choices to deviate from the spec for practicality.
from es-abstract.
This isn't a productive argument.
This is a productive argument. Even typeof something === 'function'
is a proper IsCallable
check for modern engines. Sure, some old engines have some minor issues (like FF2 callable regexes - but they are callable). But es-abstract/2020/iscallable
returns false
for classes. By the spec, classes should be callable and in too many cases in the spec [[Construct]]
checked only when [[Call]]
existent - so classes will not pass this check when they should., so this helper should never be used as an equal of abstract ES IsCallable
operation in polyfills.
from es-abstract.
The behavior of classes:
function C() {
if (!new.target) throw TypeError();
}
But it does not remove this [[Call]]
from this function.
from es-abstract.
Yes, I'm aware - and your C function there is effectively not callable, so it's most useful if an "is callable" check returns false for it. In that case, of course, it's not practically possible to do so, but that doesn't mean there's no value in doing so for class
es.
from es-abstract.
IsCallable
should check is this function callable by the spec, not effectively - otherwise, it's not an ECMAScript abstract operation.
from es-abstract.
Thanks, your opinion is noted, and the issue is already tracked in #48.
from es-abstract.
Related Issues (20)
- Add test folder to npmignore HOT 1
- Dependency Dashboard
- Why is operations/2020.js ignored ? HOT 3
- [email protected]' is not in the npm registry HOT 1
- Possible Problems with Your NPM Repository? HOT 3
- version 1.18.2 causing npm install to fail when using node 6 HOT 1
- ES.ToNumber not spec compliant with BigInt input HOT 1
- npm install [email protected] failure HOT 1
- version around 1.18 breaking CI? HOT 10
- DeprecationWarning HOT 48
- Deprecation warning DEP0148 from exports HOT 1
- re-add "exports" HOT 1
- (node:4665) [DEP0148] DeprecationWarning HOT 1
- Deprecation Warning: use of deprecated folder mapping HOT 1
- version mismatch in npm registry and during npm install HOT 1
- Action Required: Fix Renovate Configuration
- Version 1.20.2 is missing the CheckObjectCoercible.js file in Windows 11 HOT 5
- available-typed-arrays should be in dependencies, not devDependencies HOT 2
- DeprecationWarning after update to Node 16v. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from es-abstract.