Re:What can be learned from studying long gone development p...
by urthor on Monday August 23, 2021 @08:43PM
(#28283881)
Absolutely this. You need that machine language model of how a computer works to really understand programming, otherwise you are just guessing why stuff works.
I'm not capable at all with assembler, can't write my own compiler.
But my model of how a computer works, in my head, is "functions are just sequences of bits arranged as CPU instructions." I know how it works, even though I can't write a compiler or parser.
And it's absolutely essential to how I program, even in the highest level languages (SQL explain plans).
Re:What can be learned from studying long gone development p...
by zozbot234 on Monday August 16, 2021 @06:59AM
(#28196759)
> Returning a function is nothing else as returning a pointer to a memory location.
That depends. If the language supports proper first-class functions, it's basically an instruction pointer plus a record of the variable bindings the function code is "closed over" (i.e. parameterized on). Many languages do support this nowadays.
In languages like Java that want to hide everything memory related I also was struggling with grasping what a function really is. Is it even allowed to return a function?
Languages that hide memory locations and direct memory access are one of the reasons that some programmers are struggling with functions returning functions.