3 ms·
Historically programming languages were designed to transform some initial state of the machine to some other state having some specified desirable properties.
by User23 4y ago
Historically programming languages were designed to transform some initial state of the machine to some other state having some specified desirable properties. An algorithm is simply an “effective procedure” for instructing the state machine on how to go about modifying itself to achieve that end. Computing functions can and has been a use case sure, but it’s never been the only one. Simulation for example has a long history in computing. In the simulation use case there is no defined end, you just let it run and observe.
Of course one can model each state transition as a function from machine state to machine state, but that’s just a mathematical way of talking about the machine and not a programming paradigm.
You can see the legacy of the above in C, where many problems are best expressed directly as state machines. There is some confusion here because C chose to conflate functions, procedures, and subroutines, so code organization encourages use of C functions. The void return type is a workaround. It would also be idiomatic C to, for example, dispense with functions and use labels and switch/goto to organize state transitions.
Your confusion is understandable since virtually every programming language in widespread use today is at least in some sense a spiritual successor to C in the sense of adopting many of its conventions.
By the way I think Objective-S is interesting and I am glad it’s being developed. So please consider impressing readers with what actually is impressive about it.
- mpweiher 4y ago> spiritual successor to C Pretty much every major programming language in use today is a spiritual successor to ALGOL. What is ALGOL? The ALGOrithmic Language. https://en.wikipedia.org/wiki/ALGOL https://en.wikipedia.org/wiki/ALGOL And then there's some Lisp descendants, though those can't really be considered mainstream. Lisp's core is eval/apply. Prolog is an interesting case, but in many ways it just embeds the algorithm in the language. From an outside perspective, you give it something to evaluate and it runs off and returns an answer. The main outlier is the Unix shell, which, like Objective-S, is connect + run: you configure a pipeline out of filters, connect them up and then run the whole thing. And this can and will continue running indefinitely. Call/return is sort of a (common) special case. And that's interesting, because it seems to actually be easier to make call/return a special case of connect+run, but we do it the other way around.
- User23 4y agoIt doesn’t appear that you understood anything I said. This might be because you observably don’t know what an algorithm is. It has nothing at all intrinsically to do with call and return. I’m afraid any further discussion will be fruitless, but on the off chance you tire of getting predictable responses to ridiculous assertions that promote what you believe to be a deep insight, then please refer back and search for the insight required to understand what you’re being told here.
- mpweiher 4y agoLet's try that again. ALGOL. The ALGOrithmic Language. https://en.wikipedia.org/wiki/ALGOL https://en.wikipedia.org/wiki/ALGOL Which is the ancestor of C (via never-completed CPL, subset to BCPL, B, then C). Which part of this are you disputing? 1. That the inventors of ALGOL knew their language well enough to choose a correct name (or knew what an algorithm is) or 2. That C is a descendant of ALGOL? You might also want to check out "The use of sub-routines in programmes", 1952 https://dl.acm.org/doi/10.1145/609784.609816 https://dl.acm.org/doi/10.1145/609784.609816 "Sub-routines seem to have two distinct uses in programmes. The first and most obvious use is for the evaluation of functions, a simple example being the evaluation of sine x given x. The second use is for the organization of processes..."
- User23 4y agoI didn’t respond regarding Algol because you said nothing of immediate relevance requiring a response. I’m familiar with the history of Algol 60. I’m not interested in regurgitating wikipedia with you. Here[1] is a good primary source on the history of programming and significance of Algol in context for you to read. Note that call/return is nowhere mentioned. Stop chasing tangents and address your core misunderstanding. Algorithms are not call and return. [1] https://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1024.html https://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/E...
- mpweiher 4y ago