▲ | troupo 2 days ago | |||||||
Wirth was obsessed with the idea of creating the absolutely minimal useful language, and many of his languages' warts come from that. Variables are at the top because: - you immediately see them (so, perhaps, easier to reason about a function? I dunno) - the compiler is significantly simplified (all of Wirths' languages compile superfast and, if I'm not mistaken, all are single-pass compilers) However, I feel that Wirth was overly dogmatic on his approaches. And "variables must always be at the top" is one of those. | ||||||||
▲ | gingerBill a day ago | parent | next [-] | |||||||
This has nothing to do with "dogma" and something simpler. It has nothing to do with "immediately see them". Hint: This about this from a single pass compiler basis and how much memory needs to be reserved from the procedure's stack frame. | ||||||||
| ||||||||
▲ | NuclearPM a day ago | parent | prev [-] | |||||||
Lua is single pass too and doesn’t have the same restrictions. | ||||||||
|