Replies: 2 comments
-
This is a good idea. Linking related issues/discussions: I want to argue that this is different to default values in sense that usually const variables represent compile time constant values. Arguably, one of the best feature Flatbuffer has is support for structs which represent fixed size struct with no vtable, and having compile time const variables would make declaring such structs with arrays much easier and readable.
I want Also, when dealing with structs, sometimes you want to describe more complex relationship between const variables:
Any opinions? @aardappel |
Beta Was this translation helpful? Give feedback.
-
I agree having constants be declarable in schemas, usable within schemas, and output in generated code for all languages would be a great feature to have. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be Really Convenient to be able to declare primitive constants (floats, ints, strings) so that these are available in cross-language contexts. Right now my project uses a bunch of janky JSON files that declare our constants and we have a Python script that generates code for them, but it would be great to sunset that and have it all done with flatc, and kept within the same flatbuffer definition file where the associated data types are defined.
For example, I was thinking syntax like:
Ideas? Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions