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

Add boolean "not" and a "not equal" operator. #29

Closed
Dunbaratu opened this issue Apr 5, 2014 · 5 comments
Closed

Add boolean "not" and a "not equal" operator. #29

Dunbaratu opened this issue Apr 5, 2014 · 5 comments
Milestone

Comments

@Dunbaratu
Copy link
Member

(This is a repeat of an issue that was just raised on the old KOS project just before erendrake and marionoapp merged their work into this project.)

1: Add a boolean unary negation operator, as in:

If not x = 2 { ... }.

or

if ! x = 2 { ... }.

2: Also the "not equal" operator seems to be missing from the otherwise complete list of comparators:
Implement either like this:

if x <> 2 {...}.

or like this

if x != 2 {...}.
@Dunbaratu
Copy link
Member Author

To a certain extent, this is a "todo" for myself. I would like to implement this.

@marianoapp
Copy link
Contributor

The minus sign already works as a boolean negation operator, so you can do something like:

if -(x = 2) { ... }.

@Dunbaratu
Copy link
Member Author

Ugh. I'm not sure I like that solution, given the type-agnostic nature of kOS script. The idea of overloading 'minus' to sometimes mean "not" depending on if the operand is boolean or not is a bit 'iffy', since inversion in boolean symbols isn't represented with a minus sign.

@Dunbaratu
Copy link
Member Author

pull request #46 now addresses this without the list index fix attached to it.

@marianoapp
Copy link
Contributor

Closing as this was fixed in pull request #46.

hvacengi referenced this issue in hvacengi/KOS May 16, 2016
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