Use consistent template variable names
rules_pkg uses multiple template variables throughout the codebase, including:
-
%VAR% -
{VAR} -
${VAR}
Pick one (not necessarily from these), and make all uses consistent where possible. It may not be in some locations (like in the pkg_rpm script.
Originally posted by @aiuto in https://github.com/bazelbuild/rules_pkg/pull/380#discussion_r670118887
Considerations for evaluating a choice:
- are we trying to match the style of a language?
- just because Starlark looks like Python, does that mean python syntax is right?
- just because Bazel is written in Java, and the Bazel developers sometimes use Java style, does that mean that is right?
- probably neither matters because the users are coming from other build tools and probably use neither language on a daily basis.
- are we trying to match the style of a well known build tool?
- this seems reasonable if we consider that people are often migrating from something to Bazel
-
autotoolsstyle? (%{foo}) -
Makevariables. ($(foo)) -
CMake(${FOO})?Maven? - bash style (and which one,
$FOOor${FOO}?) - Windows .bat style (
%FOO%). Why not? There are more windows programmers than *ix people sometimes give credit for.
My current vote is that python style will be the least surprising, because Starlark looks so much like Python, that carrying over idiomatic coding styles is more likely to be a win than matching another build tool style. Thus my vote is to unify around {var}.
Resolved. We will use {var}