Comment by jbritton
19 hours ago
Something that might be useful would be a sub language that didn’t support all the dynamic features that make JIT difficult or slow. Perhaps a module could have a pragma or something to indicate the language set in use. Maybe like Racket. Simply not being able to add new methods or new member variables after initialization would help.
With such constraints, it should also be possible to compile it into a native binary, and then it is very similar Crystal.
This. Maybe we could call a method of the JIT (it must be exposed) and tell it that we won't use some features of Ruby, globally or inside that scope. That would let it skip some checks. Of course calling that method takes time so it should be something that is called only once. It depends on how the JIT accesses Ruby code.
And if the code actually does what we declared or must not do, we accept any runtime error that it might happen.
We must trust dependencies, including Rails if it's a Rails app.