9 ms·
Lol, yup, you are of course spot on about the problems with factory functions - of course when you are using custom JS bindings, you can correct for this by pus
by demallien 16y ago
Lol, yup, you are of course spot on about the problems with factory functions - of course when you are using custom JS bindings, you can correct for this by pushing objects with many instances down into the native layer - which I had to do on the project I'm doing at the moment, precisely because it blew out the memory.
I think that what we are looking at here is that there are two different use cases of Javascript that require two different strategies - if you want to produce subclasses of native objects, then you're going to be using factory functions, because no other solution exists in Javascript (well, at least not for JavascriptCore that I'm aware of). If you don't, then the use of a prototypal solution is more efficient.