Hacker News new | ask | show | jobs
by devjab 357 days ago
> I am not that intrigued that Python that can call some pre-compiled functions, this is already possible with any language that produces a dynamic library.

> The space that I am interested in is execution time compiled programs. A usecase of this is to generate a perfect hash data structure. Say you have a config file that lists out the keywords that you want to find, and then dynamically generate the perfect hash data structure compiled as if those keywords are compile time values (because they are).

I'm not sure I understand you correctly, but these two seem connected. If I were to do what you want to do here in Python I'd create a zig build-lib and use it with ctypes.

1 comments

Can Zig recompile itself if I change a config in production? I am talking about this

``` python program.py --config <change this> ```

It is basically a recompilation of the whole program at every execution taking into account the config/machine combination.

So if the config contains no keyword for lookup, then the program should be able to be compiled into a noop. Or if the config contains keyword that permits a simple perfect hash algorithm, then it should recompile itself to use that mechanism.

I dont think any of the typical systems programming allows this.