Re:Reconstant: Share constant definitions between programmin...
by domano on Sunday March 07, 2021 @06:34AM
(#26375043)
Environment variables do the job already, where is the benefit?
[ Parent
| on HN ]
Re:Reconstant: Share constant definitions between programmin...
by rbarrois on Sunday March 07, 2021 @06:57AM
(#26375186)
I gather that this project targets internal constants.
Let's say you need to share the list of error codes between your backend API and your frontend: instead of having to maintain two lists, just share the constants between the two codebases...
Re:Reconstant: Share constant definitions between programmin...
by nyellin on Sunday March 07, 2021 @07:14AM
(#26375292)
Environment variables don't give static type checking or autocompletion in your IDE.
Re:Reconstant: Share constant definitions between programmin...
by choeger on Sunday March 07, 2021 @07:09AM
(#26375255)
You could also do this with the C-preprocessor or CMake config files.
But a common, well-defined source language (here: yaml) should make it easy to add new backends and to adhere to language quirks (e.g., number literal formats)