4 ms·
Modern programming is. But look at assembly, which is what actual machines do. And you can write assembly with tons of gotos and not a single function in sight.
by 90s_dev 1y ago
Modern programming is. But look at assembly, which is what actual machines do. And you can write assembly with tons of gotos and not a single function in sight.
- jrvieira 1y agoModern machines do. But the dominance of imperative assembly is more about historical momentum and engineering tradeoffs than fundamental necessity. We don't have to go all-in on Von Neumann.
- antonvs 1y agoTime to read "Debunking the 'Expensive Procedure Call' Myth, or, Procedure Call Implementations Considered Harmful, or, Lambda: The Ultimate GOTO": https://dspace.mit.edu/handle/1721.1/5753 https://dspace.mit.edu/handle/1721.1/5753 The point is there's a closer connection between functions and gotos than you might imagine.
- dreamcompiler 1y agoThere's really no such thing as a 'function' at the assembler level. There are pure jumps and there are jumps that also perform side effects on a register conventionally called a 'stack pointer' (and on the memory that register points to) but no true 'functions.' This is roughly the point Steele is making, in addition to his point that the stack pointer side effects are often unnecessary (i.e. tail jumps). Implementing a stack pointer in hardware is merely a legacy hack: Before people figured out continuations they didn't know any better.
- antonvs 1y ago> There's really no such thing as a 'function' at the assembler level. That's like saying "There's really no such thing as a 'chair' at the quantum level."
- xboxnolifes 1y agoIf you look at the computer (registers, cache, RAM, storage, etc) as one whole, every assembler instruction is just a function that takes in the state of the computer and returns a new state. Multiple assembler instructions is then using function composition.
- antonvs 1y agoWell put. This is what many people seem to miss: the functional perspective is a model.