Conversation
Clarify that we should use readonly when a variable is constant as well as on a best-effort basis when the variable is not constant but should not be modified after declaration.
We no longer consider this to be a good example of a constant variable. Update example to reflect this.
faern
requested changes
Jun 29, 2022
Member
faern
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @Jontified)
bash.md line 72 at r1 (raw file):
functions are not constants. Constant variables should always have `readonly` applied to them. Non-constant variables can
Maybe give this its own heading, like ### readonly or something? I feel like it does not fully belong to the above header. 🤔
bash.md line 215 at r1 (raw file):
set -eu SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
We have to discuss and figure out if we want to treat this as a constant or not. And should it have readonly?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In bash guidelines add that constants should be
readonlyalways and that non-constants that are not modified after declaration should bereadonlyon a best-effort basis.Remove the part of the guideline that says that
COMPILER_FLAGSis an example of a constant that can be modified after declaration. After discussion this was concluded not to be the case and that this variable should not be screaming snake case.Update example to reflect this.
This change is