Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upNative classes inheritance #631
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
getify
Jul 5, 2016
Contributor
Yeah, isn't Array.__proto__ (and A.__proto__ by default) gonna be Function instead of Object?
|
Yeah, isn't |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
iliakan
Jul 5, 2016
@domenic do I get it right that Array is meant to inherit from Object? Aren't they supposed to be native classes with inheritance?
iliakan
commented
Jul 5, 2016
•
|
@domenic do I get it right that |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
iliakan
Jul 5, 2016
@domenic I mean, what you say is correct now, right, that's also what I write, but from OOP standpoint that looks strange, usually classes inherit from base Object.
iliakan
commented
Jul 5, 2016
|
@domenic I mean, what you say is correct now, right, that's also what I write, but from OOP standpoint that looks strange, usually classes inherit from base Object. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ljharb
Jul 5, 2016
Member
@iliakan a "class" produces a constructor function. Functions inherit from Function.
|
@iliakan a "class" produces a constructor function. Functions inherit from |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
domenic
Jul 5, 2016
Member
Array is not meant to inherit from Object. It is a built-in class without inheritance, just like class A {} is a non-built-in class without inheritance.
|
Array is not meant to inherit from Object. It is a built-in class without inheritance, just like |
iliakan commentedJul 5, 2016
The class semantic assumes that for
class B extends A:But for built-in classes only the 1st is true:
The second is wrong:
Array.__proto__ !== Object.Was that discussed and left "as is" for backwards compatibility? That's inconsistent.