@Listens to Baroque while coding murder.exe :newt: @Dire Sock :verified: @pistolero Doesn't Nim toolchain just convert Nim source into C source and then compiles it with a general-purpose C-compiler (utilizing its optimizations)? Basically making it a glorified preprocessor. I'm not sure how they go about WAsm though — but maybe the same way: by converting it to JS first :marseyshrug:
@m0xEE @Dire Sock :verified: @pistolero does it matter? Creating a new backend isn't exactly rocket science, especially now that LLVM exists. What matters is the language semantics. Also, if that resulting C code is guaranteed free from UB, then it's all good.
@Listens to Baroque while coding murder.exe :newt: @Dire Sock :verified: @pistolero My train of thought got derailed in the process and I haven't finished stating my though :marseynosleep: > if that resulting C code is guaranteed free from UB Exactly! I think that this is the best approach to eliminate undefined behaviour: just wrap the cases that the standard, ehm… defines as undefined behaviour around with some boilerplate to make it consistent — et voila!
@m0xEE @Dire Sock :verified: @pistolero no, the best way would be to nuke C as it is now. Look, the C standard is written probably even more vaguely than the Bible. It's inconsistent. It has terms that aren't explicitly defined or even explained with examples, but the definition of UB sometimes relies on these terms (look up "pointer provenance", for one). The very fact of existence of this mess is a testament to how much "software engineering" is an oxymoron, really. https://stereophonic.space/media/1bd93a6dbd5ddd472c6e2bd4413ae1b39a0d40035d8cda9b44bb86b11b522535.mp4
@m0xEE @Dire Sock :verified: @pistolero on a related note, pointer provenance seems to finally become described in the upcoming C23 standard. Maybe. I hope. https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2263.htm
@m0xEE @Listens to Baroque while coding murder.exe :newt: @Dire Sock :verified: > I'm not sure how they go about WAsm though If they can compile to C and LLVM can turn C into WASM, that's the answer.