Skip to content

YAMLParser: Why can't strings be constants? #51

Open
@YaseenAlk

Description

@YaseenAlk

I was reading through some of the code in GenerationGuts and noticed the following block of code (lines 1322-1325):

if (!type.Equals("string", StringComparison.InvariantCultureIgnoreCase)) { prefix = "const "; }

According to blame, the code came from this commit.
I understand that most of the YAMLParser code is over 4 years old, and is overdue for a rewrite, but I'm just wondering what the reasoning was for this explicit case. I personally like using string constants in a static context, so I commented out the string check. Running YAMLParser against common_msgs seems to be fine. Are there any weird edge cases that could arise from this decision?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions