3 ms·
"But I do think dynamic scripting languages have their place." My thought isn't actually static/dynamic, but rather the amount of dynamicness. I suspect we cou
by jerf 4y ago
"But I do think dynamic scripting languages have their place."
My thought isn't actually static/dynamic, but rather the amount of dynamicness. I suspect we could get 99%+ of the benefits of static languages at a fraction of the runtime cost if someone redid a dynamic language from scratch today to be dynamic only in selected ways. You pay a lot of runtime performance in Python to be able to do things like at any time edit a method three levels up the inheritance hierarchy, but you almost never actually do that sort of thing.
One idea I cite often is to have a declaration phase versus a runtime phase, because the vast, vast bulk of "dynamicness" is achieved at startup. A JIT could be really aggressive about a lot of optimizations if the language itself guaranteed that after a program (or a module, or a function, or whatever makes sense in the end) declares itself "done being dynamic" that there will be no more changes.
In fact I think there's a niche for a high-performance "mostly" dynamic language with threading built in from the beginning in the next 5-10 years. Static languages are getting most of the attention right now, and there's reasons for that, but I think there's a niche here that is not being well explored.
Personally I'm having a hard time using dynamically-typed languages right now because the amount of performance I'm throwing away almost makes me nauseous. That's a combination of the problem with being too dynamic, as I said, and multi-decade-old implementations not being able to be multithreaded very easily. I think a language that solved those two things could be very interesting.
- zozbot234 4y agoModern static languages generally support opt-in "dynamic" facilities. For instance, C++ has its RTTI support, Haskell has 'Dynamic' and Rust has the 'Any' trait.
- cmrdporcupine 4y agoThe thing is that behind the scenes it's just all really hashtables, so while all that that pointless dynamism is expensive computationally it's also "free" from an implementation PoV, so that's what people do. And then later optimize with caching dispatch tables, etc. etc. Honestly I'm surprised after all these years that there hasn't been any success getting serious hardware support for the kinds of dynamic dispatch tables used in late bound languages. Like hardware accelerated string hash tables, etc.