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

Implement PartialEq<Builtin> for str/String #29

Open
MichaReiser opened this issue May 15, 2023 · 3 comments
Open

Implement PartialEq<Builtin> for str/String #29

MichaReiser opened this issue May 15, 2023 · 3 comments

Comments

@MichaReiser
Copy link
Contributor

We should implement PartialEq<Builtin> for &str and PartialEq<Builtin> for String so that both ident == str and str == ident work.

@youknowone
Copy link
Member

youknowone commented May 15, 2023

Isn't PartialEq<Identifier> for str enough?
That looks &ident == str and str == &ident will work.
Is str in the example is std::string::String?

@MichaReiser
Copy link
Contributor Author

Isn't PartialEq for str enough?

I don't think it is. Implementing PartialEq<&str> for Identifier only gives you ident == str but not str == ident doc

Adding PartialEq for String is mainly a convenience. Rust also implements str == String, it would be nice if Identifiers allow String comparison too.

Is str in the example is std::string::String?

It's either a &str or std::string::String`

@youknowone
Copy link
Member

Thank you! I got it.

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