-
Notifications
You must be signed in to change notification settings - Fork 94
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
Use curly braces for all variable references #24
Comments
This is a somewhat common convention that I've not yet adopted. I understand the argument for consistency and avoiding surrounding text from being interpreted as part of the name. It's just one of those things that's so different from de facto Bash that I'm hesitant to force it upon people, including myself. I'll leave this open and if I ever use it in a project and it feels like I shouldn't go back, I'll adopt it here. Thanks for bringing this one up. |
Yeah, I've found that this is generally overkill, since I'm practically never expanding a variable next to a character that's a valid identifier character. I prefer curly-brace expansion as a signifier of "I'm doing something crazy with this variable" like replacement or substringing. But, then, I use backticks for substituting non-nested commands, so maybe I'm just lazy / character-miserly. |
It adds unnecessary visual noise, and is not required for simple variable interpolation most of the time. It's only really required when you need to stand off the variable name from a string suffix, e.g., But… …when you list off all the other times when braces are required around a variable name—parameter expansion ( |
Conventions are about picking the best way among multiple options by the spec. |
my two cents: I like to not waste time thinking about syntax/styles while coding. In this context, I mean I prefer to always use |
@meleu Yup! Conventions are not for the lazy but for the consistent. |
How about standardizing on braces?
The text was updated successfully, but these errors were encountered: