6. Packages, modules and programs

Synod follows Go.

6.1 Packages

Taught in 1. Hello

6.2 Modules

6.3 Imports

Taught in 1. Hello, 14. Packages

use github.com/synodlang/examples/gossip
use std/net

6.4 Exports

6.5 Programs and define main

Taught in 1. Hello

# package main
use github.com/synodlang/examples/gossip
use std/sim

define main
  set nodes to (sim.Cluster of 6 running gossip)
  each i, n in nodes
    if (i more than 0)
      gossip.Join n to (item 0 of nodes)
  after 10s
    sim.Crash (item 2 of nodes)
  sim.StopAt 30s

6.6 Which looks and checks are active

6.7 Themes

Taught in 12. Looks

A theme is a library package that holds the skin of a program: its colors, type and a few look settings (spec/09 §9.5).

# theme sunrise
# scene ground
define Paper
  result #FFF4E0

# scene ink
define Ink
  result #2B2B2B
# package main
use github.com/synodlang/examples/raft
use github.com/synodlang/looks/lumen
use github.com/synodlang/looks/terminal

The theme above is cut to two names for the page; a theme file holds all of them. The second block selects the theme terminal for the program.