-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Confusing documentation of &&
and ||
: what does it mean that they are “boolean” and not “logical”?
#335
Comments
Coming from Elixir, "logical AND and OR" means "AND and OR operators that treat everything except |
the xor is both boolean and logical in php afaiu php -r "var_dump(!'');
true this has nothing to do with short ciruting which I think all of these here are. in erlang and vs and/or vs andalso/orelse make a difference afair in terms of short circuit, where the latter is and the earlier is not. |
Is this about whether it accepts non-boolean values or returns them? Because PHP's |
i think so, yes. |
Do we have a way to move forward here? I think we could remove the logical/boolean split perhaps and just say that in Gleam it always wants bools |
I think that sounds good. I notice there's also this logical/boolean split for the Python page. I would suggest dropping the split there too. |
Agreed. Try and keep it simple. |
Hi, I've been reading some of the “cheatsheets” to try to understand this new language.
The operator comparison table for PHP is very confusing when it comes to the boolean operators:
&&
&&
&&
||
||
||
xor
!
!
There are two obvious mistakes (the first “Boolean not” is clearly meant to be “Boolean exclusive or”, and
!
only takes one value), but it's not what this issue is about.What I don't understand is how PHP's
&&
and||
can simultaneously be both available and not available in Gleam. I'm also confused about this “Boolean” versus ”Logical” distinction. These aren't bitwise operators, they operate on Booleans. Looking at the cheatsheet for Erlang, I guess it might be about short-circuiting? But&&
and||
always short-circuit in PHP, so this doesn't make sense. Alternatively maybe the “Logical” rows are meant to have the PHPand
andor
operators, but that would also be confusing, because these operators behave identically to&&
and||
aside from precedence, so they arguably aren't missing an equivalent in Gleam. In general, I'm not sure what “Boolean” versus ”Logical” should imply.So, this section probably needs to be re-written by someone who understands what this is meant to mean? If I can make a suggestion about the other cheatsheets, they might be clearer if they said “short-circuiting” and “eager” rather than “Boolean” and ”Logical”. It was only when I looked at the Erlang one that I was able to piece together what this might mean, since its operator names suggested a short-circuiting distinction.
The text was updated successfully, but these errors were encountered: