(See discussion of module params & APIs for more context.)
A thought: could modules have optional parameters? Then one might declare a module as
Unicode: {language ? EnGb} -> [capitalize]
And then when importing it one could either choose to not pass in a parameter and use the default configuration, or one could pass it in and make an explicit choice. Would enable easy use of default configs.
Seems reasonable :)
This seems doable. I still have quite a few things to do before I can start implementing params, but my plan was to parse the params in the header as a regular record pattern.
So we might get this for free, at least the parsing of it.
Cool!
If all module params are optional, should we require at least an empty record like we do for functions?
import Unicode {}
Or can the module be imported as if it had no params?
Requiring the record makes it more of an explicit "using the defaults" choice, but it means that adding params later would be a breaking change even if they were all optional
I would vote for the empty {}, it means it works the same way as function calls with all optional record fields
In the same way that ? and ! will work the same way, it would be nice to have language features that "work like you expect" because we have generally consistent rules
Yeah, that's what I'm leaning towards too
I can see arguments for both, but I also like the consistency of including the empty {}. In my mind I think of modules with parameters as functions of the parameters, hence we are "calling the function" when we perform the import. In contrast to modules without parameters, which are more like constants.
Last updated: Jun 16 2026 at 16:19 UTC