Help Shape the Mojo Language Reference

Hi, Erica from Docs again, :wave::books:

We’re prototyping a new Mojo language reference and would love your feedback as we refine it. The goal is to build a reference developers can trust.

This section is specifically about language reference, not tutorials or guides. Each page follows a simple rhythm with explanations, lots of examples where we can fit them in, as well as caution/pain points. That structure lets readers stop early if they got their answer, or keep going if they want the mechanics.

Another design constraint: reference material has to stay correct as the language evolves.
The direction we’re exploring balances human writing and editing with automatically generated reference so the pages stay maintainable as Mojo changes.

Since we can’t share a live preview yet, attached are screenshots of the prototype layouts. Some screenshots are from early mdBook prototypes. Others show the current design running on our docs site.

We’d especially appreciate feedback on:

  • Is this easy to scan?

  • Does the structure make sense?

  • Is anything missing that you expect from a language reference?

  • Anything here that would slow you down while coding?

If you regularly rely on references like cppreference, Rust docs, or Python docs, we’d especially like your take.

This is early design work. Your feedback will help shape how the Mojo reference evolves.

2 Likes

Pretty cool and very useful !
It is structured, and personally easy to scan from my first read.

That is really cool that this is small and concise,
as it could teach an small model on small gpu some mojo too.

I did also take an look to the golang reference today,
while thinking about the parameter topic on the forum.

1 Like

I use cppreference on a weekly basis, if not more often. I think it’s the best language reference that exists for any language, not just C++. In my view, this is because it’s extremely consistent not only in its prose style and text formatting but also in its high-level structure (e.g., section ordering) and visual cues:

  • Every page flows down from a concise summary, to technical details, to code examples, and then finally with references and links. This section order is the same for almost every page
  • Every piece of technical jargon (“C++ standard-ese”) is color-coded and hyperlinked to a dedicated page that has a complete explanation.
  • There are extremely visible visual cues to indicate language changes with new standards. (This is typically my primary use case for consulting cppreference.) Lots of these are visible on this page for constexpr, for instance: constexpr specifier (since C++11) - cppreference.com.
1 Like

This is fantastic and would be a great resource!

  • Easy to Scan: Yes
  • Structure is sensible: Yes
  • Anything missing: not really, but links to the main manual for more info could be nice.
  • No
1 Like

I like it. The first screenshot is a bit bare (the one with keyword references), but that’s a nitpick.

One thing popped into my mind while I was looking at the examples. It is nice to have simple examples, but it is also great to see more complex examples in the wild. Would it be possible to automate standard library scanning for examples and put them as external links to Github repo for people to explore? I think that might be very helpful for people who want to go deep on topic and concepts they are not familiar with. The sample links would need to be re generated on every major Mojo release, but this also makes sure that nothing got stale.

1 Like

I think something closer to a BNF grammar (see JSON) might be helpful here. For example, I’m not told what I can put after except or assert, or what characters can go in string literals. What I can see of escape sequences is also missing raw unicode literals. Thinks like for loops also need their API contracts explained.

Mojo syntax highlighting should definitely be applied to this.

Ideally, we should make sure each block can be checked by the compiler, likely by piping it into the repl. Mojo already has a bit of a problem with out of date documentation and I think it’s important to avoid making that worse.

Nits:

For “String - Mutable UTF-8 Strings”, mentioning that most people should prefer codepoint indexing where possible is probably a good idea.

Assignment statements ignore var foo = ... and ref foo = ...

The :fire: extension is gone.

2 Likes

I think something closer to a BNF grammar (see JSON) might be helpful here.

It may be something to consider after the initial releases.

The :fire: extension is gone.

Most of the screenshots are from the earliest prototypes.

1 Like

I’ll look into this as part of the stdlib examples work and see what’s feasible.

1 Like

I use this: The Python Language Reference — Python 3.14.3 documentation and this: The Python Standard Library — Python 3.14.3 documentation extensively for Python. I find them well optimised for finding the information you’re looking for quickly. I don’t see why it shouldn’t work for Mojo.

1 Like

It should be available as an epub to read on small screens like smartphones, epub allow word wrapping while pdf are static both should be available options.

1 Like

It is very useful!
Can you share a downloadable form of it? (md or pdf)

1 Like

I’ll defer to @BradLarson on anything beyond the documentation site.