4 ms·
> They don't have Claude write assembly because there is no training corpus on people making CRUD apps in assembly. I suspect that despite its translation abil
by dehrmann 3mo ago
> They don't have Claude write assembly because there is no training corpus on people making CRUD apps in assembly.
I suspect that despite its translation abilities, this is true, but I'd like to see it do things in languages that are more or less appropriate for tasks to see how much the training corpus matters vs. its ability to translate. Assembly is a bit of an extreme example because you're either writing it as close to C as possible (C is essentially portable assembly) or you're writing complex, unreviewable code that happens to work. And who know if it's been trained on register allocation, or resorts to doing everything on the stack because it works.
- LtWorf 3mo ago> C is essentially portable assembly Not really, assembly shows you what the machine instructions actually are. In C you have loops, functions structs. All things that make no sense in assembly.
- deleted 3mo ago[deleted]
- gnabgib 3mo agoLoops (conditional JMPS - JE/JNE/JZ/JNZ/JB/JNB.. and a dozen others) and functions (CALL, RET) exist in assembly. Goto is there too (all JMPs). C makes assembly sense.
- fragmede 3mo agoOh that's an interesting thought. Goto's are considered harmful, because holy hell as a human trying to understand and reason about code, the spaghettifcation if someone else used gotos all over the place and I have to reconstruct their thought process just doesn't sound like fun. But if we're no longer writing code by hand (which, I gotta be honest, I'm using AI to write a lot of code for me these days), then does that still matter? If a human isn't going to have to understand the code, can we get more performance out of existing systems by considering goto's useful?
- dehrmann 3mo agoCompilers only really use them for things like break and the end if blocks. There isn't much to gain by being able to execute anything arbitrarily, and then go...where? There might be places here and there within a function where compilers already take advantage of it, but I doubt it's useful in the way you think.
- LtWorf 3mo agoin C it's quite normal to set a return code and jump to a cleanup section where all the buffers are freed, all the files closed and so on.
- galaxyLogic 3mo agoI assume there's a clear technical reason why GOTO is harmful, it adds to the complexity of the code, makes it harder to understand and fix and evolve. Wouldn't the same difficulties affect the LLMs ability to understand and fix and evolve the code as well?
- fragmede 3mo agoAs a human with a human level of working memory, the number of things I can keep in my head and map to concepts and functions is unfortunately limited. An AI running on an Nvidia supercomputer has higher limitations on what it can hold in its working memory, so could theoretically handle more than my human brain can.
- LtWorf 3mo agoBut it won't because it's a language model no an artificial intelligence.
- t43562 3mo agogoto is already useful as an end-of-function cleanup. You pop one at the end of each function (the naming is local to the function) and that's the place where you free ram if the pointer's not null and close the file if the handle is not null and so on. Then you don't have to litter all of your if/else clauses with hundreds of memory frees and cleanups - you just "goto" The fact that this is controversial to some people just shows how rules like "Dont use goto" become stupid - if one is trying to make code simpler then there are cases were not using it is the more confusing and error prone choice. As for "can we now do anything" well if you don't ever need to debug "anything" then yes and if you have any small doubts about your LLM then no.
- hresvelgr 3mo agoBoth points are specious. C disassembly is usually not an orthogonal translation of the structures in the code, usually due to optimisation. > In C you have loops, functions structs. All things that make no sense in assembly. One can reasonably infer that a loop will roughly translate to some type of conditional jump instruction. Function structs are just pointers and call instructions. The former point was that there is little runtime getting in the way of how the constructs could be expressed, and a long time ago it may have been the truth, but not for modern compilers.