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)
Hard 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.
Re:Faster CPython (2021) [pdf]
by ericvsmith on Sunday January 23, 2022 @10:17PM
(#30053329)
dataclasses do not use metaclasses (I’m the dataclasses author).
Apologies, I must have been confusing it with some other Python syntax tricks I've seen. I don't write too much Python anymore..
Smalltalk JITs do just fine with introspection and certainty Python does not have some magic feature that Smalltalk lacks.
Despite being a totally different language based around message passing with no control structures?
None of those are insurmountable, they merely make writing a JIT harder if you want to support them: it’s hard to inline a function call if the inclining can have a visible effect.
That is the whole point, it doesn't get more dynamic than that.
I’d say the lack of control flow structures and message passing would make it far, far easier to JIT.
If that was the case, there would be no need for StrongTalk.
Can you really not think of any other benefits?
I certainly can, and I can also think of several examples of dynamic languages that succeed where Python fails.
All of them just as dynamic, if not more.
If you can think of other benefits to Strongtalk other than “it makes jit compiling better” then why say that there is no reason for it to exist if Smalltalk’s design makes it easy to JIT?
Python is not even able to do the basic Smalltalk part, so it doesn't matter what StrongTalk brings into the picture.
Ok now we are on the same page about there being a need for Strongtalk other than “it may or may not JIT better” we will loop back a few comments and try again:
I’d say the lack of control flow structures and message passing would make it far, far easier to JIT.
The second is the inspect module that builds on that, allowing you to get the stack frames, inspect function signatures etc.
The third is trackbacks, which need the stack and themselves are introspectable.
The fourth is metaclasses (making dynamic classes at runtime).
These are heavily used in Python, and are optimisation barriers. For example PyPy (Python with a JIT) disables optimisations when “inspect” is imported or used anywhere in the call stack.