4 ms·
For a couple of years, I’ve been thinking about whether there could be a simpler language that gets rendered into safe Rust the way Nim is translated into C and
by Nomentatus 4y ago
For a couple of years, I’ve been thinking about whether there could be a simpler language that gets rendered into safe Rust the way Nim is translated into C and compiled as C. I’ve concluded that it is possible, but only if there’s a substantial chunk of AI sitting “in between” that analyses the code you’re writing in the simpler language and queries you, the coder, from time to time.
I’m not sure how coherent I can be describing what I have in mind, but for example: let’s say you’re happily typing and the AI chimes in to say to the coder: “Hey, it looks to me like you may be assuming, in what you’ve written so far, that your process A will always end before your process B. Maybe - maybe - in the real world that’s so. But I can tell you that logically it ain’t so. What Rust code do you want me to write, here: 1) one that just goes from your process A to your process C whether or not your parallel process B has finished or not, or 2) Rust code where B always waits for A, A always waits for B, or both wait for each other, or 3) unsafe Rust code that leaves this possible race condition intact ‘cause your sure- you’re willing to bet the company - that not just this version of the program, but all possible future modifications of it, are never gonna encounter a real-world instance of B being delayed? And do you want any telemetry (asserts) (”fries”) with that?”
Exactly how the AI can borrow check without you doing much if any borrow checking is maybe harder to describe; but might involve informing you that the code you’ve written so far allows simultaneous updating of a variable, and what would you like to do about that, if anything? Would you like some telemetry to let you know if such nonsense begins to happen during a run? (Fleshing this out may be non-trivial.)
The AI would also bring stuff like badly formed loops allowing buffer overwrites to your attention, of course.
I’m quite sure that creating such an AI programming helper/translator into Rust would be difficult. But I suspect it’s possible, and I want one. I’m retired, I won’t be building it.
See verdagon's very interesting comment here (and the replies to that) for what's already being done at least a little along the same lines.