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

Consider using less morally-loaded language in hints. #1584

Open
NorfairKing opened this issue Apr 10, 2024 · 3 comments · May be fixed by #1591
Open

Consider using less morally-loaded language in hints. #1584

NorfairKing opened this issue Apr 10, 2024 · 3 comments · May be fixed by #1591

Comments

@NorfairKing
Copy link

NorfairKing commented Apr 10, 2024

I know I stand a good chance of being ridiculed for this, so please hear me out, but feel free to ignore this issue entirely.

Hints are sometimes phrased as "Perhaps you should remove it." which seems to imply that "a person who does remove it is a better person".

f msg (Just x) | null xs = [msg ++ " you should remove it."]

This issue exists just to suggest replacing "should" by "could".
Or even: "You may be able to remove it."

@ndmitchell
Copy link
Owner

I'm happy either way. No intention to make a moral judgement. Maybe even simplify further to "Perhaps remove it." ? Only concern is breaking people who match on it with regexes or what not, but hopefully that's fairly rare.

@googleson78
Copy link
Contributor

I'm all for being more sensitive and non-hurtful, but I believe changing "should" to "you may" or "you could" is changing the semantics of the sentence from a "this might be an improvement" to "it's unclear whether this is better, but you could do it".

In the first place, I believe that hlint aims to give some hints about improving code - if the suggestion was not an improvement, at least in some scenarios, then why not remove it entirely from the hlint suggestions set?

Perhaps I'm just misunderstanding your grievance, though.

In the sentence

Hints are sometimes phrased as "Perhaps you should remove it." which seems to imply that "a person who does remove it is a better person".

what makes you feel that "Perhaps you should remove it." implies some personal fault in the person reading the message? I feel that language is fairly gently phrased, and it seems like the same language people use in code review all the time (IME), to make suggestions to other people, with no intent (or effect, I assume) of being hurtful.

Or to put it differently, how would you phrase a suggestion to change something that another person implemented, in the case where that change would be a justifiably objective improvement?
For example, how would you suggest to someone that they should use foldl' instead of foldl in a scenario where they explicitly want their fold to run in constant stack space?

@NorfairKing
Copy link
Author

NorfairKing commented May 7, 2024

@googleson78

I'm all for being more sensitive and non-hurtful, but I believe changing "should" to "you may" or "you could" is changing the semantics of the sentence from a "this might be an improvement" to "it's unclear whether this is better, but you could do it".

That's the entire point. Using words like "better" when it comes to a subject that isn't a moral one is dangerous.
You aren't a good programmer. You're a skilled programmer.
Being skilled doesn't make you any better of a person.

Code isn't better or worse either. It's more effective/efficient/easier to maintain/...

In the first place, I believe that hlint aims to give some hints about improving code - if the suggestion was not an improvement, at least in some scenarios, then why not remove it entirely from the hlint suggestions set?

There are plenty of cases in which hlint cannot be sure that the code it suggests is preferable, but I still want to read its feedback.
For example: redundant parentheses or duplicated code.

with no intent (or effect, I assume) of being hurtful.

To be clear; I don't intend to suggest that this language was used with harmful intent.
I'm just pointing out that we can use more accurate (amoral) language to discuss an amoral subject.

For example, how would you suggest to someone that they should use foldl' instead of foldl in a scenario where they explicitly want their fold to run in constant stack space?

"This fold does not run in constant stack space, see this comment. I think you will want to use foldl' instead."

@ndmitchell: I think the regex use-case can safely be ignored because there is a --json flag AFAICT.

@NorfairKing NorfairKing linked a pull request May 8, 2024 that will close this issue
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 a pull request may close this issue.

3 participants