malloydata / malloy

Malloy is an experimental language for describing data relationships and transformations.
http://www.malloydata.dev
MIT License
2.01k stars 76 forks source link

Add dialect namespace with dialect functions #1881

Closed christopherswenson closed 2 months ago

christopherswenson commented 2 months ago

This adds a new namespace underneath the global namespace, which dynamically contains function definitions specific to the current dialect.

This PR does not add very many function definition, just sets the groundwork for it.

There are no name conflicts between the "global" namespace (where Malloy standard functions live) and this dialect namespace. If there were, you would always get the global version, since they are always stacked and there is no way to explicitly access one namespace or another. The intent is that in the future, you can explicitly reference dialect.function_name to access the conflicting version — e.g. dialect.starts_with(x, "prefix") would give you three-state boolean null behavior rather than the "Malloy standard" two-state boolean null behavior.