Hacker News new | past | comments | ask | show | jobs | submit login

Honestly ChatGPT-4 sucks at writing code (if similar code isn't in its corpus of knowledge).

I asked it to write a YAML parser in pure Rust. The first thing it did was write this:

    pub enum YamlNode {
       Scalar(String),
       Sequence(Vec<YamlNode>),
       Map(HashMap<String, YamlNode>),
    }
This is what I expect a freshman in college to write as their first Yaml parser.

Literally unusable as a starting point.

I did try to correct it but it tripped up and somehow managed to fuck that up to.




Why does it suck, because it's doing a lot of allocations?


No. You have a fair point, but not my biggest gripe. It's much more fundamental to what YAML is.

YAML allows YamlNodes as keys in a map (aka complex keys). E.g.

    ? [ a, b]
    : "complex key, scalar value"

You asked it for YAML parser and it gave you a shitty JSON parser.

Also this is the most banal thing about YAML, something that should be obvious just browsing the examples. And I gave it test suite and link to YAML spec.

Most work in YAML is around super obscure corner cases.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: