3 ms·
One thing I'll note is we tend to use languages from different levels in different settings (front end, back end, systems) and we spend an awful lot of time wri
by andyferris 2y ago
One thing I'll note is we tend to use languages from different levels in different settings (front end, back end, systems) and we spend an awful lot of time writing glue code to get them to talk to each other.
A major advantage of the proposed approach is automated FFI and serialization/deserialization between languages in the same language set. RustScript would be able to accept a struct or enum from Rust or RustGC, and vice-versa. You could have a channel with different languages on either end.
You can also see that we _want_ something like this, e.g. we bolt TypeScript on top of JavaScript, and types onto Python. If JavaScript (or python) were designed so they could be more easily compiled (notably, no monkey patching) then they would support level 2 as well.
I have been thinking of level 2 or 1 languages that support the higher levels. This is a really good framing. (The problem with going the other way is the implementation decisions in the interpretter often constrain how the compiler can work, e.g. CPython is dominant because all the libraries that make use of the CPython FFI, and similarly for NodeJS. It is easier to interpret a constrained language than to compile a dynamic language designed with an interpretter in mind).
- sitkack 2y agoBack when I did some high perf Python, I’d define my data at C structs and bump allocate those structs in a list using the cffi. It is not unlike defining your data model for SQL so that you can have sane data access.
- zahlman 2y ago>bump allocate The term isn't familiar to me, and when I try to look it up I get almost exclusively Rust-related results. I guess you mean https://en.wikipedia.org/wiki/Region-based_memory_management https://en.wikipedia.org/wiki/Region-based_memory_management , which I grew up calling "pool allocation".
- sitkack 2y agoI am using it a euphemism for reserving address space and then committing pages as your list grows. This isn't preallocating memory, just address space. But pool allocation works as well. The idea is to go from a chonky representation to a portable compact representation of a C-struct but still have the Python accessors to this data look idiomatic.
- zahlman 2y agoIn what sense is reserving address space not "preallocating memory"? It might not be allocated to an object, but it certainly is allocated to your process... yes?
- Wumpnot 2y agoNo address space does not mean you have memory, you can reserve gigabytes of address space and your process will still show nothing allocated until you commit it.
- zahlman 2y agoAh, of course. Never mind me; when I learned low-level concepts, hardware was much simpler (and so were operating systems).
- eterps 2y agoThis a 100%. It's madness that languages are effectively siloed from each other.