Share / export constants between Wing files and libraries #3606
Labels
🛠️ compiler
Compiler
✨ enhancement
New feature or request
📐 language-design
Language architecture
📚 libraries
Wing Libraries
Feature Spec
Wing now supports bringing specifying constants as shared/public by a module (Wing file), and then bringing them into other Wing modules.
Use Cases
Reusing information (supporting DRY). Example:
Alternative syntax suggestions welcome.
Implementation Notes
The design reason to only support sharing constants (and not any values) is to avoid the semantic ambiguities that arise when sharing mutable values across module boundaries:
In the initial version, a list of types we can support as constants are:
num
str
bool
duration
datetime
Json
Array<T>
,Map<T>
, orSet<T>
whereT
is a valid constant typeT?
whereT
is a valid constant typeFree floating functions and may also be reasonable to share across module boundaries in the future.
Component
Language Design, Compiler
Community Notes
The text was updated successfully, but these errors were encountered: