Hacker News new | ask | show | jobs
by sitkack 693 days ago
Afaik there was a prototype Ruby JIT that used the C compiler this way and loaded the resulting code as a shared library. I did this with a Python decorator and ctypes so I could inline and hot reload my C extensions using

   @c_func
   def add1(n : int) -> int:
       """
       return n + 1
       """
I haven't touched this space in years, I think there are a couple Python libraries that do this now. I did not generate C code at runtime tho.
1 comments

nice!