4 ms·
How many of these "levels" (not to confuse them with actual classes) exist in javascript? Only the first one? (that said, I guess the fourth one (metaclasses)
by funklute 5y ago
How many of these "levels" (not to confuse them with actual classes) exist in javascript? Only the first one?
(that said, I guess the fourth one (metaclasses) isn't a clear yes/no, since OO is very different in js)
- Jasper_ 5y agoHard to compare exactly with that classification, but JavaScript only has the first one, and arguably parts of the fourth one. metaclasses isn't really a major optimization hazard, it effectively boils down to hijacking the "class" syntax to instead run some custom code. It's used by things like dataclasses and the Django ORM to use class syntax to make a little DSL.
- ericvsmith 5y agodataclasses do not use metaclasses (I’m the dataclasses author).
- Jasper_ 5y agoApologies, I must have been confusing it with some other Python syntax tricks I've seen. I don't write too much Python anymore..