Replies: 3 comments
-
There are a few existing issues. The oldest/most prevalent is probably: #27 |
Beta Was this translation helpful? Give feedback.
-
when would uses as:
You could think that "not" is method defined in the same, derived or static using class. |
Beta Was this translation helpful? Give feedback.
-
Congrats. C++ has a lot of problems that C# doesn't have. This is a very weak argument. If you really need it just create a No need for a keyword that's probably going to be in use for more pattern matching stuff when you can easily do it yourself. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Not sure if this has been brought up before, would love your thoughts on it.
Background
Many of my colleagues and I personally prefer using
== false
in a negative comparison instead of the bang sign!
. The reason being, it's easier to spot, especially when one is debugging a live-site/SEV in the middle of the night. For example:if (!isUserAuthorized)
vsif (isUserAuthorized == false)
.Proposal
The proposal here is to introduce a
not
keyword as an alternative syntax for the unary logical not operator (!
). This keyword should not require a set of parentheses after it (just like the existing!
operator). For example:if (not isUserAuthorized)
, which is exactly equivalent toif (!isUserAuthorized)
.This syntax should also work:
if (not(isUserAuthorized))
.For what it's worth, C++ also has this
not
keyword (amongnot_eq
,and,
andor
).Beta Was this translation helpful? Give feedback.
All reactions