Skip to content

Naming convention for local constants #13247

@xtqqczze

Description

@xtqqczze

Our coding guidelines the naming convention is to: "Use `PascalCase to name constant local variables and fields." and is common with dotnet repository guidelines.

On the other hand, the style for local constants is mostly camelCase in existing code so we should consider the logic for this part of our coding guidelines.

In #13217 (comment) @rjmholt made a persuasive case we should use camelCase instead of PascalCase for local constants:

My thinking is that that's only for global constants (which behave most like value macros), rather than local constant variables (which can hold references and for which const indicates just immutability rather than referential transparency)

If we used camelCase for local constants this would be a violation of SA1303ConstFieldNamesMustBeginWithUpperCaseLetter but there is an open issue as to whether the rule should apply to local constants as well as fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalityResolution-No ActivityIssue has had no activity for 6 months or more

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions