by daurnimator · 10y ago · 0 comments
Array.prototype[0] = 5;
and make [] the same as [5].
Huh? I don't know what you mean by this.In lua you can easily replicate javascript's prototype inheritance.
The former allows straight forward optimization of the simple case, simply accepting the performance hit of the stuff built on top (which still might benefit from some of those optimizations), while the latter forces the optimizer to invest a large effort into distinguishing between the simple case and the exceptional, and then there still needs to be an always-on fallback path from simple to exotic.