What it means. A function signature declares a parameter without a default after a parameter that has one. Defaults must be contiguous and at the tail of the parameter list.
package main
func create(a int = 5, b int) int = a + b
// ^^^^^ no default, but follows a default
func main() {
Println(create(1, 2))
}
error[GALA-E0013]: parameter "b" in create has no default but follows a parameter with a default
--> e0013.gala:3:1
|
3 | func create(a int = 5, b int) int = a + b
| ^^^^ move parameters with defaults to the end of the parameter li…
|
= hint: move parameters with defaults to the end of the parameter list
The caret marks the declaration; the header names the offending parameter.
Reorder so every default sits at the end:
func create(b int, a int = 5) int = a + b
Or give the follower a default too:
func create(a int = 5, b int = 0) int = a + b
With mixed defaults, positional calls become ambiguous: does create(7) mean a = 7, b = default or a = default, b = 7? Requiring contiguous trailing defaults keeps positional calls unambiguous, while named-argument calls can still pick any subset.