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

add explicit flags to remove some booleans in the CE typechecker #9975

Merged
merged 1 commit into from
Aug 20, 2020

Conversation

baronfel
Copy link
Member

This is a slight cheese-move away from primitive obsession.

Tinkering in the CE typechecking I kept getting mixed up around what the two boolean flags that tryTrans takes meant. So I pulled them out into named values and adjusted callsites for clarity.

Further documentation on the types could go into why specific flags are chosen.

@TIHan
Copy link
Contributor

TIHan commented Aug 20, 2020

I think this change is good as I don't like boolean flags on functions, especially when there are a lot of them.

Would a change like this set precedent for similar changes in the future?

@baronfel
Copy link
Member Author

I would love to make similar changes in the future, I just specifically scoped this one small so that I wouldn't cause as much churn and/or make the review harder than necessary. A little bit of the Boy Scout rule applied to the codebase :)

@TIHan
Copy link
Contributor

TIHan commented Aug 20, 2020

The scope of it is fine, I'm just curious if that is the route we want to take from here on out.

Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love it if we took a route like this to eliminate the magic bool flags. Every time I see a naked true and false my brain turns off, and that's including the code I wrote that does the same.

@cartermp cartermp merged commit 14a29ca into dotnet:main Aug 20, 2020
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
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

Successfully merging this pull request may close these issues.

4 participants