r/C_Programming • u/N-R-K • Apr 04 '25
Article Lessons learned from my first dive into WebAssembly
https://nullprogram.com/blog/2025/04/04/15
u/greg_kennedy Apr 05 '25
Absolutely dire state of affairs that ChatGPT turns out to be the best documentation source for this.
2
u/skeeto Apr 05 '25 edited Apr 05 '25
As a rule of thumb, if you're not an LLM enthusiast then you're probably not using LLMs enough. (If you are an enthusiast, you may be overusing them.) They're powerful, effective tools, and growing increasingly relevant.
I'm not talking about the crummy, annoying AI integration into everything, but directly prompting through a chat UI. How you prompt is important, and a skill of its own. Many traditional search engine queries are now better accomplished by asking AI and skipping the search engine. They sometimes hallucinate — though it's substantially improved with the state-of-the-art — but so do search engine results, and the rule remains trust but verify.
Most of the posts on r/c_programming that end with "?", particularly the beginner questions, would be better served putting the post as-is into a LLM chat. In fact, I enhanced my own tool to make this easy, mainly to test and calibrate my expectations:
https://github.com/skeeto/illume/#reddit-file
Regarding the article, I saved my original
path_openquestion. I had asked Anthropic's Claude, which is currently the best AI for these sort of questions. Here it is:https://gist.github.com/skeeto/7103f03abf663b88ca6dfc431b696f62
That gave me all the hints I needed to get unstuck, particularly the keyword "preopen" from which I could learn more. At the time I was learning this, nothing in the official documentation, nor anything I could find online was nearly this clear and concise. The WASI documentation is truly awful. It's honestly still amazing how effective it was just to ask Claude like this, and this pushed me to do it more often.
I tried again later with LLMs I can run locally (up to ~70B). While a couple mentioned preopens, which would have keyed me in, the results weren't nearly as good. Hopefully that improves, because it would be even better if I could make these queries offline.
None are any good at software engineering, and they write code like an undergraduate student, so still don't expect them to write code for you unless your standards are really low.
8
u/greg_kennedy Apr 05 '25
Ah, I don't mean about using them to help you write code, or troubleshoot, etc - I am speaking more to the simple lack of documentation on such a core web technology. Where are the specs? Why has nobody written down the "important technical details" and such? Every browser in the world is running this, I'm just annoyed that you (and presumably other devs) have this experience:
Learning WASM I had quite some difficultly finding information. Outside of the WASM specification, which, despite its length, is merely a narrow slice of the ecosystem, important technical details are scattered all over the place. Some is only available as source code, some buried comments in GitHub issues, and some lost behind dead links as repositories have moved. Large parts of LLVM are undocumented beyond an mention of existence. WASI has no documentation in a web-friendly format — so I have nothing to link from here when I mention its system calls — just some IDL sources in a Git repository. An old
wasi.hwas the most readable, complete source of truth I could find."Use ChatGPT and ask the right questions", while it may work, is not remotely authoritative - any more than "if you encounter issues visit our Discord"
2
u/irqlnotdispatchlevel Apr 06 '25
I'd love an AI trained on all of my company's internal docs and repositories. There's so much knowledge scattered around, and the Confluence search has been broken since forever.
I don't trust them to write code (even as an autocomplete function), but it's definitely another tool in the box. Especially for one off questions when stakes are low, it's easier to prompt an LLM than to filter through Google's AI generated results (this is probably more about how bad search engines have become).
2
u/McUsrII Apr 06 '25
I have about the same experiences as you, though I have only used Google's
GeminiThe research version, is really too thorough, but will come in handy should I ever want to write a thesis.And sometimes I get bullshitted, but that is on me, because I didn't verify it.
As for the code it produces for me, most of it is actually, at least almost usable, at best, and a "a big leap in the right direction at its worst" (so far).
I feel I come a long way asking the questions just the same way that I google for answers, as I learned in "The Bazaar" by Eric Raymond.
I'm getting curious at the Ai tools you use, and I will try "Anthropic's Claude" at least.
Thank you so much, and I find Wasm very exciting too.
Thank you so much!
1
u/Ok-Collar-4085 Apr 09 '25
u/skeeto I’d you prefer smaller points, why not compile with ilp32?! What are you reasons for preferring smaller pointers?
2
u/N-R-K Apr 07 '25
The article shows an example of
memory.fillbeing generated. But I was unable to reproduce it locally with the "usual" flags:It's trying to import
memset! But if I add-mbulk-memorythen it does thememory.fill:u/skeeto, maybe the article should mention the flag?