5 ms·
> The equal sign should be reserved for comparisons, because that is what it means in mathematics. This is touching on a pet peeve of mine: Mathematics and pro
by znkr 1y ago
> The equal sign should be reserved for comparisons, because that is what it means in mathematics.
This is touching on a pet peeve of mine: Mathematics and programming are similar in many aspects, but this is not one of them. In mathematics = is not a comparison, but a statement.
More generally, mathematics is about tautologies, that is statements that are always true. In programming, a comparison is evaluated to either true or false.
That doesn’t mean that there’s no room for conditionals in mathematics (one example is piecewise function definitions). But it’s not the same. Heck, even the definition of “function” is different between mathematics and programming.
- mastermage 1y agoThat's why procedure is so much better of a name. It's not a hill I'm willing to die on but I think it's correct.
- ffsm8 1y agoAnd let's use the keyword "go-to" to run a function, back to the basics basically ಥ ‿ ಥ
- mastermage 1y agook maybe not that, that was awful.
- jasperry 1y agoSeconded. Languages could even use "function" only for pure functions and "procedure" for everything else. Pascal uses "procedure" for things that don't return a value, but I think the pure vs. side effect distinction is more useful.
- austin-cheney 1y agoIn languages that have block scope a procedure is that block. It’s a boundary but receives no input and does not return output. Functions do allow input and do return output. This distinction is clear in C lang that has both functions and procedures. As a new language design feature procedures could be assigned to references for reuse in the same way as calling a function by name/variable.
- jasperry 1y agoI've never heard of blocks in block-scoped languages being called procedures. I feel like the word "block" is well understood and serves the purpose fine. In lots of other languages, things called procedures do take input, like Ruby, which has first-class Procs like you mentioned.