Skip to content
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

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

Open
YaseenAlk opened this issue Aug 6, 2018 · 2 comments
Open

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

YaseenAlk opened this issue Aug 6, 2018 · 2 comments

Comments

@YaseenAlk
Copy link

YaseenAlk commented Aug 6, 2018

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!

@nuclearmistake
Copy link
Collaborator

nuclearmistake commented Aug 6, 2018 via email

@YaseenAlk
Copy link
Author

Thank you for the very quick reply!

I'm new to ROS, so I'm not sure if string constants are actually used in practice. But I do remember that I needed to adjust some lines in GenerationGuts in the past. They're in one of the commits in the PR I made a few days ago.

Removing the string check, while including the above commit, runs successfully on common_msgs (although I've been doing all of my testing on .NET Core 😝).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants