Skip to content
FutureBlitz

    Install

    Learn

    Modules and packages

    Split a program into files and folders, control what each file shows, and build with other people's packages.

    Every .fb file is a module, which shows other files only what it marks Public. A package is a folder with a project.toml, which names it and lists the packages it depends on, from a folder on disk or from a registry. These tutorials go from a program in a few files to a package that others can add to their own projects.

    Tutorials

    1. Several files Split a program into files, mark what other files use as Public, and import files by their paths.
    2. Modules and Import Import std's modules and folders, give a module a short name with As, and take only some names with From.
    3. Visibility Decide who sees each declaration, with Private, Protected, Package, and Public.
    4. project.toml Make a package with fb new, name its modules by its name, and set what project.toml controls.
    5. Using packages Depend on a package from a folder or from the registry, pin its version in fb.lock, and update it.
    6. Publishing a package Make a library others can use, document and test it, and publish it to the registry with fb publish.

    The rules behind this area are in the language reference.

    Report an issue with this page or with FutureBlitz on GitHub.