Forc 36.0 Breaking Changes

Breaking changes were released in Forc version 36.0 for importing libraries and using constants defined in the Forc.toml file.

  • Defining and structuring modules in Sway project has been reworded. The dep keyword has been removed from the language in favour of mod: mod declarations include a single ident specifying the name of the submodule. Note that this is different from dep declarations which would supply a /-separated file system path to the submodule. Since the name of the submodule is specified in the declaration, submodules no longer need to supply their name via a library name; header at the start of the file and can instead use the plain library;. The name of a submodule is used to find the source file for that submodule. For a submodule named bar of a module foo, either the file foo/bar.sw or bar.sw must exist. These paths are relative to the file defining the foo module containing the mod bar; declaration. It is an error for both or none of these paths to exist. Module paths behave the same as they previously did except that they use module names instead of library names.

  • Definition constants in Forc.toml is no longer supported. Instead, configurable constants defined in a configurable block should be used. These constants do not change throughout the execution of a Sway program, but they can be changed at “configuration time” using the Rust SDK for example.

1 Like