Comment

Comment by xscott

I think we could step back and make a list of programming languages features that are helpful or harmful to LLMs writing code. I don't have a complete list, but things I've thought about:

    Useful error messages at compile time
    Fast compilation to iterate and fix those errors
    Efficient memory, CPU, and maybe GPU at runtime
    Familiar from the training data [0]
    One obvious/preferred way to do things
    Explicit types
Rust hits some of those, but not all. I can't think of a language that hits all of them, but a lot of people sure love to rationalize why their own favorite language is the best choice. LLMs don't need syntax sugar and other niceties, and any errors postponed to runtime are a burden on you, not the model.

We could add a few more rarely seen features to increase confidence in the results and make future modifications or switching models go better:

    Required pre-conditions and post-conditions
    Enforced limits on function or method length
    Mandatory test cases
    Enforced naming conventions
    Lean style proofs of correctness?  (probably not)
I'm on the fence about things like linear/affine types for memory management vs garbage collection. Obviously you want memory safety, but there's more than one to get that, and I don't know that you want to force contortions to build simple data structures.

[0] LLMs are very capable of programming in languages they've never seen before. I've had them write programs using my own toy compilers for my own toy languages. However, you waste a lot of prompt tokens up front explaining things, and then they waste a lot of thinking tokens trying to get it right. Any new language would have a chicken and egg problem here, but LoRAs and model refinement could bridge the gap.

parent xscott 17 days ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton