-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
change requestA proposal for changes to an existing featureA proposal for changes to an existing featurescriptingAbout Typst's coding capabilitiesAbout Typst's coding capabilities
Description
Description
Currently, calling array.join on an empty array returns none. There should be a default argument, similar to the one on array.sum or array.product, defining the value to return for an empty array (defaulting to none).
Use Case
It is easier to write arr.join(", ", default: "") than
#if arr.len() == 0 {
""
} else {
arr.join(", ")
}Drawbacks
As mentioned in #6780 (comment), the proliferation of default arguments may indicate than a more general solution should be implemented. In the meantime, this proposal makes sense.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
change requestA proposal for changes to an existing featureA proposal for changes to an existing featurescriptingAbout Typst's coding capabilitiesAbout Typst's coding capabilities