You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Imagine you want to perform the following common pattern: see, that if something is valid, then if its something else is true.
For example, you want to filter out people whose name surely doesn't end with "mia", however some accounts don't have names, and you can't say anything about them:
Does that mean name is null for them?
I may not fully understand your purpose for this operator/infix function, but is this similar to how safe method calls work in Kotlin?
Or maybe safe calls are only subset of this operator functionality?
I don't see any point in this, when you can just use (not a) or b which is clearer and doesn't add an extra feature to maintain. It just adds extra cognitive load, and one more thing new users have to learn.
Problem
Imagine you want to perform the following common pattern: see, that if something is valid, then if its something else is true.
For example, you want to filter out people whose name surely doesn't end with "mia", however some accounts don't have names, and you can't say anything about them:
Definition
Syntax
If we're going to do literal logical operators, like
and
,or
, etc., then the syntax should beimplies
.Otherwise, it could be
==>
, for example.Meaning
The meaning of
A implies B
is(not A) or B
.The operator priority of it should be the lowest, even lower than equality:
a + b == 0 implies a - b < 0
is(a + b == 0) implies (a - b < 0)
.Under the hood
It could be either an operator or infix function. The concern with infix functions is precedence, since
implies
should have a very low priority.Examples
1.
2.
The text was updated successfully, but these errors were encountered: