$ ./gawk --dump-variables 'BEGIN { @let (a, b, c = 1) { } }'
$ cat awkvars.out
$let0001: untyped variable
$let0002: untyped variable
$let0003: 1
ARGC: 1
ARGIND: 0
ARGV: array, 1 elements
BINMODE: 0
[ .. snip many ]
https://www.kylheku.com/cgit/egawk/about/Subroutine calls in the ancient world, before computers had stacks or heaps
11–20 of 241 posts
Re: Subroutine calls in the ancient world, before computers had stacks or heaps
#12Am I the only one who read it as the ancient world before computers existed had stacks or heaps? English is so weird sometimes...
Re: Subroutine calls in the ancient world, before computers had stacks or heaps
#13I understand, why the provided example does not allow for recursion, but doesn't it also prevent a nested call to another subroutine?
If I remember correctly before FORTRAN90 we already had nested subroutine calls. How did that work?
EDIT: I think I get it. The hidden global variables are prefixed with the sub's name. This is pretty wasteful, but as long as a function does not call itself (even indirectly) we are good.
Re: Subroutine calls in the ancient world, before computers had stacks or heaps
#14The article does not distinguish between recursive and nested subroutine calls. I understand, why the provided example does not allow for recursion, but doesn't it also prevent a nested call to another subroutine? If I remember correctly before FORTRAN90 we already had nested subroutine calls. How did that work? EDIT: I think I get it. The hidden global variables are prefixed with the sub's name. This is pretty waste…
Re: Subroutine calls in the ancient world, before computers had stacks or heaps
#15I would imagine that other compilers took a similar approach which wasn't mentioned.
EDIT: There were some BASIC interpreters which did this as well, implementing a VM and then targetting that instead. P-Code is a similar thing.
Re: Subroutine calls in the ancient world, before computers had stacks or heaps
#16I really liked the Art of Computer Programming with regards to this subject. While seemingly obsolete, there are a ton of pre-heap / pre-stack algorithms for dynamically changing arrays or other data structures. The book also builds up to garbage collection and how to implements Lisp-lists. The kind of encyclopedic knowledge you'd expect from Knuth. ------- One of my favorites is how to have two Arrays dynamically ta…
It wouldn't surprise me if it was a direct inspiration, since their docs cite TAOCP for the btree structure itself.
Re: Subroutine calls in the ancient world, before computers had stacks or heaps
#17Getting recursive functions into ALGOL turns out to have been a controversial move that made for a fun story: https://vanemden.wordpress.com/2014/06/18/how-recursion-got-...
Re: Subroutine calls in the ancient world, before computers had stacks or heaps
#18Am I the only one who read it as the ancient world before computers existed had stacks or heaps? English is so weird sometimes...
I sincerely doubt that English is the only language that supports such word play.
Re: Subroutine calls in the ancient world, before computers had stacks or heaps
#19You could do tail recursion, because only the return address of the first call would be needed to be stored. `branch_with_link` would be used for the initial call, but the recursive calls would have to be regular branches.
Re: Subroutine calls in the ancient world, before computers had stacks or heaps
#20Note that before we had arbitrarily extensible heaps, programmers always did at least a little engineering, in that they had to consider the probable distribution of inputs and size* all their intermediate storage appropriately. * giving rise to "BUGS AND LIMITATIONS "