-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specification for read-only (or const) defines #101
Comments
Fwiw, I feel we don't need to enforce this programmatically initially, having a strong hint to the user that some defines should not be modified will probably be already very helpful (so picking a good name "const", "protected", "readonly" ....) is helpful :) |
Is the current idea of warning on overwrite enough? |
(ignore the cruft):
|
Haivng a way to warn about overrides is nice but it feels slightly orthogonal to me. It's hard to know before we actually have a full set of image definitions in otk but my gut feeling is that there will be quite a few overrides in any normal otk compile run. Plus even with it, it does not help with the discoverability that Achilleas mentioned, that a user with a misconception about how things work easily falls into a trap. But I guess it's fairly trivial to turn the override warning into an actual error for |
While discussing the partition table generator with @mvo5, we considered the idea of having a way to signal that certain defines shouldn't be modified after they're set (even producing an error if they are). This is especially important for large, complicated data structures generated by externals where there are interdependencies between values (like the partition table).
Consider the following scenario:
${filesystems}
If this is allowed, it'll throw off the the partition table consistency and partition positions and alignments. Changing other values could also make the whole thing unbuildable (which might be better or worse depending on POV).
It would be nice to have a way to protect values inside data structures generated by externals in some way, perhaps with a keyword convention (
const
?). So in the example above, the generator adds theconst
(or whatever) keyword to the data structure it produces, making the property${fileystems.const...}
and anything underconst
can't be modified after it's set the first time and doing:produces an error.
The text was updated successfully, but these errors were encountered: