nickmqb/muon

Document core and standard library functions

Opened this issue · 3 comments

Document core and standard library functions

What format would this best be done in? Man pages are pretty cool for their convenience.

I'm personally a fan of just adding comments to the .mu source files, at least for now. This can be as simple as:

// Returns the substring starting at byte index `from` and ending at byte index `to`.
slice(s string, from int, to int) string {
    ...
}

The main advantages being that there is no separate document to maintain, and users can easily jump to the documentation from their code once the language server is ready. We can also build some tooling to auto-generate easily browsable documentation.

Longer term/for higher level docs, we may want to consider other approaches. As you mentioned, C uses man pages; would be interesting to see what other languages use and compare a few approaches.

Note: we should also add explicit return types for all core and standard library functions.