8000 false != true · Issue #217 · ChaiScript/ChaiScript · GitHub
[go: up one dir, main page]

Skip to content

false != true #217

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

Closed
define-private-public opened this issue Oct 13, 2015 · 4 comments
Closed

false != true #217

define-private-public opened this issue Oct 13, 2015 · 4 comments

Comments

@define-private-public
Copy link

I toyed around with the boolean operators a bit. This came up

eval> true == true;
true
eval> false == false;
true
eval> false == true;
false
eval> true == false;
false
eval> false != true;
Error: "Can not find appropriate '!=' operator." With parameters: (const bool, const bool) during evaluation at (1, 1)
eval> true != false;
Error: "Can not find appropriate '!=' operator." With parameters: (const bool, const bool) during evaluation at (1, 1)

Shouldn't false != true return true instead of throwing an error?

@lefticus
Copy link
Member

Good catch. Are there any other boolean comparison operations I might have missed? I cannot think of any others.

@define-private-public
Copy link
Author

Not sure, I can check later. In ChaiScript, is false == 0 and true != 0 like in C?

@lefticus
Copy link
Member

That's the one thing I'm explicitly doing differently from C and C++: I've made bool more strongly typed so it does not automatically promote to integer.

@define-private-public
Copy link
Author

It also might be a good idea to write some unit tests for the boolean operators like &&, ||, and !.

lefticus added a commit that referenced this issue Oct 16, 2015
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
0