Using MoonBit + async + the Proton UI library, you can easily create your own desktop pet ✨
Here’s a demo of a Gemini desktop pet written entirely in MoonBit 👇
#MoonBit #moonbitlang
MoonBit is exploring the introduction of a real tracing GC — aiming to completely eliminate memory leaks and deliver better build & runtime performance. Expect it!😄
#MoonBit #moonbitlang
Now, you can debug MoonBit program in new native backend in vscode, just like JS and llvm backend~ 😁
#moonbitlang #MoonBit
MoonBit now supports patterns in for ... in ... loops.
You can destructure items directly in the loop header — a long-awaited feature!😁
#moonbitlang #MoonBit
4
99
Kaida Amethyst retweeted
我们马上要成立公司了。作为一个编程语言团队,能融到钱非常不容易, 但是AI时代应该做更难,更hardcore 的事情,容易的AI自己就能搞定了。对Agent 和wasm 云端部署调度感兴趣的欢迎联系我们,我们也招产品经理,求转发! @moonbitlang
We are designing and developing specialized debugger for MoonBit 😁. Not only for human, but also for AI.
A true AI native debugger will soon available on MoonBit! 😁
#moonbitlang #MoonBit
Kaida Amethyst retweeted
Why MoonBit is more rusty than Rust? Part 1, MoonBit pattern match is more powerful/expressive than Rust. It is beyond pattern match on ADTs, built in support for JSON, vector, string, map and binary stream even SIMD and we have exhastive checks! gist.github.com/bobzhang/2ec…
Kaida Amethyst retweeted
Beyond JSON, MoonBit can continue pattern match over binray stream incuding SIMD types (exhaustive checks still) , all beyond Rust's reach gist.github.com/bobzhang/13e…
Not only JSON, MoonBit has static awk style string processing intergrated, this makes MoonBit ideal language for scripting (and we have exhaustive checks too) gist.github.com/bobzhang/520…
Just tried MoonBit’s new `errdefer` feature — resource cleanup that only triggers on error/cancellation. (Just released in v0.10.9). Super handy for constructors and makes error handling way cleaner😁
Before and After ↓
#moonbitlang #MoonBit
Codex 特么SB吧,调个llvm binding库的use after free问题愣是给我整出cybersecurity check出来了,这种代码都能触发安全检查?!
已放弃治疗转投DeepSeek阵营了
2
5
522
My Favorite MoonBit Feature #14: `.mbt.md`
How do you build a reliable AI coding project? And how do you avoid ending up with a codebase that was written by AI but is no longer understandable to you?
I do not think the best approach is to write a huge test suite, hand it to an AI, and simply say:
Write a program that passes all the tests.😅
A better approach is to first spend dozens—or even hundreds—of rounds discussing the project with the AI.
Discuss the architecture, type design, APIs, usability, naming conventions, constraints, trade-offs, and everything else that shapes the system. More importantly, ask the AI to continuously document the discussion and record the decisions that have already been made.
Only then should you start writing the code.
This gives the implementation something concrete to follow. It reduces the risk of the AI introducing concepts you do not understand, choosing abstractions you never agreed on, or silently making important design decisions on your behalf.
In the AI era, a code repository should contain more than just code. It should also preserve a substantial amount of knowledge.
Documentation is essential because code alone cannot fully explain:
Why was this design chosen?🧐
Why was another design rejected?🧐
Why was something introduced in the past, but later removed?🧐
Which alternatives were considered?🧐
Which constraints shaped the current implementation?🧐
In other words, a repository should preserve not only its implementation, but also its reasoning and decision history.
Documentation, however, has its own problems. It can become outdated. Different documents can contradict one another. Explanations can be incomplete or simply wrong.🥲
This becomes especially dangerous when working with AI over a long period of time: outdated documentation does not merely confuse humans—it can repeatedly mislead the AI as well.
What if we could perform static analysis on documentation, using the actual codebase as context?
That would allow us to detect contradictions, stale examples, invalid assumptions, and incorrect explanations much earlier. It would help keep the repository’s knowledge consistent and reduce the chance of feeding misleading context back into the AI.
MoonBit’s `.mbt.md` format is a great example of this idea.😄
It allows MoonBit code blocks embedded in Markdown documents to be checked together with the rest of the codebase. While discussing and documenting a project with AI, outdated or incorrect technical descriptions can therefore be discovered and corrected much earlier.
In the future, a great MoonBit repository may be defined not only by high-performance code, but also by a high density of reliable, verifiable knowledge.
Not just a Code Base, but a Knowledge Base.☺️
#moonbitlang #MoonBit
「怎么让AI帮助你理解一块代码」
最好的办法是,让AI对照这个模块,给你重建个新的,但是拆分成很多个commit,每个commit实现一个小块,全部的commit组合起来完成这个模块的复制,然后你一个commit一个commit看过去,不懂的就跟AI讨论。
有的时候你还得记点笔记啥的,没事,让AI去记。
一个一个地讨论透才能叫理解。
不要直接让AI给你解释,或者试图用静态分析画图之类的,理解一块代码哪有这么容易😂。
1
2
149
A neat MoonBit trick: write finalizers directly in MoonBit.😆
Suppose a MoonBit value wraps a native resource—a C string, database connection, socket, and so on. You may want the resource to be released automatically at the end of the object’s lifetime, instead of requiring users to always call `close()` or remember to use `defer`.
External-object finalizers are usually defined in C. But on the Native target, the cleanup flow can jump back into MoonBit—with no new language feature required.😜
Define a capture-free callback as a FuncRef, then pass it to C when creating the external object. On Native, the FuncRef becomes a function pointer that C can register as the finalizer. When the object is released, the runtime calls back into MoonBit and runs your cleanup logic.
Here is a minimal CString demo 👇
The key part in this example is `make_cstring_in_mbt`: it receives the finalizer callback and passes it to `moonbit_make_external_object`.
lmao~
#moonbitlang #MoonBit

















