Follow

why do we have programming paradigms for "if"s and "and"s but not "but"s

· · Web · 6 · 1 · 4

@joshmillard I feel like a but every time I write any code

@joshmillard "but" and "and" are logically identical, differing only in that one of them implies the conjoined elements to be similar and the other implies them to be different

@fool i think in gate logic terms that'd have to be "but also", which by extension could also be considered "yes, and..."

@joshmillard

Imperative languages (basically Algol/C family) don’t need coordinating conjunctions (basically each statement terminator ; is an “and then…”), only correlative conjunctions. When one lemma of an and expression is negated, that could be read as a but. Maybe that be a good idea and would make those programs more grokkable. But to implement it you’d put but and and as synonyms (like @fool said).

a && !b → a but not b

!a && b → not a, but b

This semantic view of code is also why single-statement blocks bug me so much. It’s like saying “OK, I’m gonna rattle of a list of things for you to do now so please be ready. OK, here we go: A. That was it. Did you get that?”

@joshmillard here is my chance to invoke the "because" operator (or its dad++ extension, "just because")

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!