3 ms·
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
by Ygg2 3y ago
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.
- hderms 3y agoWhy does it suck, because it's doing a lot of allocations?
- Ygg2 3y agoNo. 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.