SPB Git

Repository Public

migration.md 2.6 KB

# Versions and migration

# Three version numbers

What Current Meaning
Language 0.1 what a source file means
IR schema 1 the shape of the JSON printed by sonata build
Toolchain 0.1.0 a particular build: sonata version

They change independently.

# The version line

A file may begin with the language version it was written for:

sonata
sonata 0.1

composition "Versioned" {
    instrument piano: GrandPiano {
        play C4
    }
}

The line is optional. Without it, a file is read as the language of the tool that compiles it. A file that asks for a newer language than the tool knows is refused (I7004): the compiler never guesses at syntax it does not understand. The formatter keeps the line as you wrote it and never adds one.

# What may change

Until version 1.0:

  • A patch release (0.1.x) does not change the meaning of a program that compiles, and does not make a valid program invalid — except to fix a compiler bug that contradicted the specification; such fixes are listed in the change log.
  • A minor release (0.2) may change syntax or meaning. Each such change will come with an entry in the compatibility page, a diagnostic that explains the old form and, where a mechanical rewrite exists, an automatic migration.

There is nothing to migrate in 0.1: it is the first version.

"Meaning" is the compiled music: the same source and the same seed give the same notes, times, automation and routing. The sound of an instrument or effect belongs to the engines; a change to the sound of a preset is announced in the change log as a behaviour change.

# Things that can grow without a new language version

  • The standard library can gain names. A definition in your project with the same name always takes precedence, so a new standard name cannot break your project.
  • Engines, effects, parameters with a default, and presets can be added.

# Projects

A .sonataproject records the version of its own format. The app opens older formats and updates them when you save; it refuses, with a clear message, a project written by a newer version of the app, instead of risking your data. Backups of your sources are kept outside the project (Modules and projects).

# Stable interfaces

  • The command line's exit codes and the fields of its --json output.
  • The diagnostic codes: a code keeps its meaning; new codes can be added.
  • The // expect: comments understood by sonata test.

The full policy is Documentation/spec/compatibility.md.

Files main
Menu

Theme