-
Notifications
You must be signed in to change notification settings - Fork 462
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
chore: remove the coercion from String to Name #3589
Conversation
This coercion has led to a number of subtle bugs and frustrating situations for me in the past. It seems to me that coercions make sense when there's a single canonical mapping from one type to another, where the target of the coercion is in some sense intuitively "the same". But in this case, there are two mappings, both of which make sense in different situations, and if I forget to use the correct one, I'd rather get a type error to remind me than a program that silently computes the wrong answer. |
Mathlib CI status (docs):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a bunch of stylistic suggestions for the changed code along with some tweaks for the Lake fixes.
@david-christiansen, if you'd be able to rebase onto |
This coercion caused difficult-to-diagnose bugs sometimes. Because there are some situations where converting a string to a name should be done by parsing the string, and others where it should not, an explicit choice seems better here.
Co-authored-by: Mac Malone <[email protected]>
85880b8
to
a634068
Compare
OK, rebased on |
Thanks for the great feedback, @tydeu! |
Co-authored-by: Mac Malone <[email protected]>
@david-christiansen The speedcenter is failing because the Lake benchmark is using this coercion in its lakefile: lean4/tests/bench/inundation/lakefile.lean Lines 10 to 12 in 32dcc6e
This can be changed to EDIT: Applied it myself to hopefully save you some time. 😄 |
What a wonderful surprise, as I show up to do it! Thank you! |
This coercion caused difficult-to-diagnose bugs sometimes. Because there are some situations where converting a string to a name should be done by parsing the string, and others where it should not, an explicit choice seems better here.