MoxyMoxy
Docs contents

Stability and 1.0

Moxy is at 0.4.0. Until 1.0, any release can change anything, and docs/changes.md says what did. This page is the contract that starts at 1.0, and the list of things that must be true before 1.0 ships. Nothing here is a promise about the current releases.

The compatibility promise

From 1.0, a program that compiles without errors and runs correctly with one 1.x release compiles and runs correctly with every later 1.x release, with three exceptions:

  • the program relied on a bug, and the fix is listed in docs/changes.md with the reason;
  • the program was rejected for memory or type safety reasons the compiler had missed (it accepted something it should not have); the fix is a new error, and the release notes say how to change the code;
  • a warning, lint or diagnostic message changed. Diagnostic text is not part of the contract; exit codes are.

Anything that would break more than that waits for 2.0.

Syntax

Covered by the promise:

  • the grammar in docs/grammar.ebnf, and the reserved words (C's keywords plus string, bool, true, false, null);
  • the meaning of valid C: C code that Moxy accepts keeps its C meaning in every release;
  • the behavior documented in the language reference, including the names and signatures of the built-in methods and the standard library modules in std/.

New syntax can be added in a minor release if it was invalid before. It never takes over a spelling that was valid C or valid Moxy. New contextual words are allowed, because contextual words are only recognized where C would have a syntax error, so existing C that uses them as names keeps compiling.

Not covered: anything the reference marks as unsupported, and features documented as experimental. An experimental feature is named so in the reference and in the release notes, and is not used by the compiler's own source.

The C output

moxy emit produces C that people read, debug and sometimes link. Some of it is a promise and most of it is not.

Covered, because C code and build systems depend on it:

What Promise
Names of functions and plain types that you define A function count_words in a .mxy file is the external C symbol count_words. A namespaced name geo::dist is geo__dist.
Plain C structs, unions and enums Same layout as the C compiler gives the same declaration. They can be shared with C code through headers.
Function signatures made of C types The C function has the C types you wrote. A const char * parameter stays a const char *.
The generated library header For a type: "lib" project, <name>.h declares every function whose signature C can express with the declared name and types. A function with a Moxy value type in its signature stays out of the header, as now.
#line directives Compiler and debugger messages point at the .mxy source.
Compiler requirements Generated C is C11 with the GNU builtins __atomic_* and __attribute__, which gcc and clang provide. A change to this list is a breaking change.

Not covered, and free to change in any release:

  • everything named mxy_*, the layout and size of strings, lists, maps, closures, futures, Result and ref struct objects, and the runtime header contents. These are not an ABI. Don't read or construct them from C. Moxy values that cross into C are opaque handles that only Moxy code may touch;
  • the helper functions, witness tables and temporaries the generator writes;
  • the order of definitions and the exact text of the output. Don't diff generated C across versions;
  • the symbol names of lambdas, thunks and other generated helpers.

If you need a stable boundary between Moxy code and C code, put C types in a header and implement the functions in Moxy, as in the adoption guide. That boundary is what the promise covers.

The exported surface (names and types) stays compatible across 1.x. Linking objects built by different 1.x compilers is allowed only for that surface. Two objects that each contain Moxy values must come from the same compiler version, because the object layout may differ.

moxy.yaml

Covered:

  • every key documented in the README and in the goose documentation (project, build, dependencies, workspace and their documented fields), with the same meaning;
  • the default values of those keys;
  • moxy.lock: a lock file written by one 1.x release is read by every later one.

New keys can be added. An unknown key is a warning, not an error, so a file written for a newer release still builds on an older one, with the key ignored. A key is deprecated for at least one minor release, with a warning that names its replacement, before it stops working in the next major release.

Command line

The commands, flags and exit codes documented in the README. Output meant for people (progress lines, diagnostics) is not covered. Output meant for programs is: moxy emit writes only the C to standard output,.

Criteria for 1.0

1.0 ships when all of these are true. Each has a way to check it.

  1. The language is in. The roadmap's phases 1 (generics, methods, optionals, typed errors, slices) and 2 (the memory model) are done or explicitly cut, and the reference describes the result. Check: the reference has no "planned" sections.
  2. Every documented claim has a test. Each safety claim in the memory chapter has a test that fails if the claim stops holding. Check: a script lists the claims and the tests.
  3. No known memory-unsafe behavior in safe code. The crashes listed in Phase 0 are fixed, and the test suite plus the benchmark programs pass under AddressSanitizer and UndefinedBehaviorSanitizer on Linux and macOS, with leak detection on Linux.
  4. Self-hosting is stable. make verify passes, the compiler builds from a clean checkout using only a C compiler and make, and compiling the compiler to C stays under the 100 ms budget in the roadmap.
  5. Windows and the two Unix families work. CI builds, tests and verifies on Linux, macOS and Windows.
  6. The tooling exists. The language server, formatter, linter and test runner work on the standard library and the compiler's own source.
  7. There are real programs. At least one substantial C program or module has been ported, with published line counts and measurements, and at least two projects the maintainers did not write build with the release candidate.
  8. The standard library surface is settled. Each module has tests, docs, and no function that is planned to change. Modules that aren't settled are marked experimental or left out.
  9. A release candidate has been out for a month with no breaking change needed. A change that breaks the promise above resets the clock.
  10. The compatibility policy above is checked in CI. A corpus of programs from earlier releases (the test suite and the examples at each tag) must still compile and pass.

After 1.0

  • Patch releases fix bugs only.
  • Minor releases add features that pass the change process and don't break the promise.
  • Major releases may break it. Each breaking change is announced one minor release earlier with a warning where one can be produced, and ships with a migration note in docs/changes.md.

Edit this page on GitHub