So I’m sort of abusing default arguments to provide input examples for dictionaries in lieu of custom types and type checking. I’ve been trying to understand when and why a function throws unexpected argument.
To provide an example, take these two functions:
#let degree_str(edu: (
degree: "Bachelor of Arts",
major: "Bull Engineering",
)
) = {
let deg = edu.degree
if "major" in edu { deg = deg + " in " + edu.major }
return deg
}
#let edu_item(
edu: (
name: "Sample University",
degree: "Bachelor of Arts",
major: "Bull Engineering",
//...
)
) = {
let degree = degree_str(edu)
//...
//displays content
}
It took me a while to work out when using default arguments this way, this error is thrown for functions that return values, but not for functions that simply render content. Why is that the case though?