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

Equality and truthiness with strings #168

Closed
palfrey opened this issue Oct 14, 2018 · 2 comments
Closed

Equality and truthiness with strings #168

palfrey opened this issue Oct 14, 2018 · 2 comments

Comments

@palfrey
Copy link
Contributor

palfrey commented Oct 14, 2018

Which one is it? Binary comparison says "Convert the string to a boolean using all defined aliases" but then doesn't define what to do in the failure case, and Truthiness says "String - Truthy" (with no qualifiers).

@wizered67
Copy link

These behaviors aren't necessarily exclusive. In Python for example, if "hello": print("hello") will print "hello", but print("hello" == True) prints False. That being said, we should clearly define the intended behavior when the string can't be converted to a boolean.

I'm actually wondering if converting the string "false" to the boolean false when comparing them is confusing. In if "false" and if "false" is true would have different behavior since the comparison converts it but the conditional treats all non-empty strings as truthy.
`

@palfrey
Copy link
Contributor Author

palfrey commented Mar 7, 2020

There's a related issue in nothing.rock in that the empty string is defined as equal to null, despite the spec saying String <op> Null => Non equal.

@dylanbeattie dylanbeattie closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2024
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

3 participants