Error codes
When Saka finds an error in your code, it reports a code, such as SK4301, with a message that explains it. The message can change from one version of Saka to the next; the code stays the same. In each example, the comment marks the line where the error is reported.
SK4001
Syntax that does not parse.
def total = (1 + 2 // SK4001: the parenthesis is never closedSK4101
A construct that is not valid where it stands, such as a statement in a module body.
var visits! num = 0visits += 1 // SK4101: in a module, an update belongs in a procedureSK4201
A name declared twice in one scope, or a top-level name that reuses one of the prelude.
def total = 1def total = 2 // SK4201: total is already declaredSK4202
A name that is not found, or that names the wrong sort of thing.
def total = missing + 1 // SK4202: missing is not declaredSK4211
A declaration in the wrong place, or with missing, extra, or invalid parts, including an invalid stored key.
var visits = 0 // SK4211: a var needs a contract, such as visits! numSK4221
An import that cannot be resolved.
use mod pricing = "pricing.saka" // SK4221: there is no file pricing.sakaSK4231
A dependency cycle.
def even = odd // SK4231: even and odd read each otherdef odd = evenSK4232
A recursive binding that does not end in a distinct or one reducer, or that reads its group inside a narrowing or where more Values could remove results.
def rec growing* num = {1, growing + 1} // SK4232: no distinct ends it, so it would grow foreverSK4301
A Value or contract that does not fit the contract it must.
def wrong! str = 1 // SK4301: a number does not fit strSK4302
A call with the wrong number of arguments.
def double(x! num)! num = x * 2def wrong = double(1, 2) // SK4302: double takes one argumentSK4304
A form that needs context and has none.
def unknown = {} // SK4304: nothing says what the Bag holds, as num:{} doesSK4306
A cardinality or repetition count that is out of range.
def wrong: num'2..1 = 1 // SK4306: the range ends below its startSK4307
An arm of match whose Set the arms before it already hold.
def size(n! num)! str = n match { _ ~> "any" 1 ~> "one" // SK4307: _ already matches 1}SK4308
A match whose arms leave part of its subject’s Set.
def name(n! num)! str = n match { // SK4308: no arm matches 2 or the other numbers 1 ~> "one"}SK4311
An expression or Set that is not valid.
def outside = [1, 2].5 // SK4311: the Tuple has positions 0 and 1SK4321
A Set parameter that cannot be inferred.
def make[set T](): T'0 = T:{}def made = make() // SK4321: nothing says which Set T isSK4322
An update that is not valid.
val fixed! num = 0
proc wrong(): void = { fixed += 1 // SK4322: a val never changes}SK4401
A pattern, lexer, or parser that is not valid.
reg twice = (tag = alpha'+, tag, tag) // SK4401: a capture is matched again only onceSK4411
A grammar choice or lookahead that cannot be decided by a bounded look ahead.
peg Overlap = ["car", "caravan"] // SK4411: both alternatives start with "car"