News for hackers. Stuff that matters.
Re:From Languages to Language Sets by andyferris on Sunday March 16, 2025 @07:30PM (#43383616)
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).

Re:From Languages to Language Sets by sitkack on Sunday March 16, 2025 @08:46PM (#43384056)
Back 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.

Re:From Languages to Language Sets by zahlman on Monday March 17, 2025 @11:36AM (#43389639)
>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 , which I grew up calling "pool allocation".

Re:From Languages to Language Sets by sitkack on Monday March 17, 2025 @06:06PM (#43393210)
I 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.

Re:From Languages to Language Sets by zahlman on Monday March 17, 2025 @08:49PM (#43394542)
In 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?
Re:From Languages to Language Sets by Wumpnot on Tuesday March 18, 2025 @12:32AM (#43395780)
No 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.
Re:From Languages to Language Sets by zahlman on Tuesday March 18, 2025 @08:08PM (#43406810)
Ah, of course. Never mind me; when I learned low-level concepts, hardware was much simpler (and so were operating systems).
Re:From Languages to Language Sets by eterps on Monday March 17, 2025 @03:55AM (#43386115)
This a 100%. It's madness that languages are effectively siloed from each other.