Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Adding dynamic library loading to my pet programming language (github.com/nbittich)
33 points by nbittich on Sept 27, 2023 | hide | past | favorite | 5 comments



I'd love to see some details on what you encountered while adding dynamic loading. There are a lot of decisions to make. In python, importing a package executes the static blocks. In the JVM, import doesn't have a side effect but the first actual usage causes statics to run. Similarly you need to decide what you'll do with conflicting names. Namespaces? last one wins?


Thank you for your interest! It wasn't too hard to be honest, the actual tradeoff is that the shared object must have been built with the same version of rust that was used to build the runtime(see https://github.com/nbittich/adana#plugins)

for the way it's loaded, it's like in nodejs with common modules:

my_lib = require("/path/to/my_lib.so")

or for standard lib:

fs = require("@std/fs")


It also executes a bunch of code in C++ (at least for Windows) and can do all sorts of wild stuff. It happens when you define globals with constructors that the compiler can't/doesn't optimize away.


Pretty sure "Adana" is just the kabab part, and not "a long, skewer-cooked ground beef kabab put alongside fries in a sliced baguette, covered in mystery sauce" :P


Ahahh, the name would have been too long xD




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: