3 ms·
> Incorrect. No static analysis can establish the constant in some of those cases if only because they are not provably constant. Which one of those is not pro
by kllrnohj 7y ago
> Incorrect. No static analysis can establish the constant in some of those cases if only because they are not provably constant.
Which one of those is not probably constant? They all are literally hardcoded constants?
- pron 7y agoThe methods are not constant: def foo Array.send(:define_method, :sort) do; [100, 200]; end end puts eval([1, 2, 3].inspect).sort[1] * 2 foo puts eval([1, 2, 3].inspect).sort[1] * 2 But, anyway, my points isn't about partial-evaluation of values specifically (although JITs can and do do that); instead of int and 2 you can consider a type with 4 billion subtypes. JITs do specializations that an AOT simply cannot possibly do (not without code explosion). Now, as I wrote in the original comment, I'm definitely not saying that JIT compilation is "better" than AOT. I am saying that the "zero-cost abstraction" philosophy of C++/Rust and the "zero-cost use" philosophy of JITs are two extremes that are each perfectly suited to two very different software domains.