Deprecate `!a == b`

IchorDev zxinsworld at gmail.com
Wed Aug 14 06:45:23 UTC 2024


On Tuesday, 13 August 2024 at 21:02:28 UTC, Nick Treleaven wrote:
> On Tuesday, 13 August 2024 at 20:40:32 UTC, IchorDev wrote:
>> On Tuesday, 13 August 2024 at 20:30:10 UTC, IchorDev wrote:
>>> Do we really need to pander to people who don’t even 
>>> understand that logical operators only *return* `bool`?
>
> I think it's actually that they don't know the operator 
> precedence, or they just made a mistake.

My point being that it’s a weird mistake to make, and one I’ve 
never seen. Have you ever seen it before?

>> A problem I have actually had is not being able to parse the 
>> operation order for expressions like `1 + 2 * 3`, but I don’t 
>> think we should require parenthesis there either.
>
> Agreed, because that syntax comes from maths rather than a 
> subset of programming languages.

I learned programming to learn programming, not to learn 
mathematics. A lot of concepts from mathematics are completely 
incompatible with programming because we work with numbers that 
have to be physically stored. You can’t store irrational numbers, 
you can’t even store recursive fractions without a special 
encoding system, and even then there’ll still be a fraction 
that’s too long to store in the universe.

>> Also, here’s a nice case where I’d actually want to write 
>> this: `!myInt == myBool` Again, here the parenthesis would 
>> just be visual noise.
>
> The diagnostic doesn't need to fire when both sides are bool.

Well there’s still situations like ternary enums to account for.


More information about the dip.ideas mailing list