History of Idiom 207 > diff from v7 to v8
Edit summary for version 8 by programming-idioms.org:
New Go implementation by user [programming-idioms.org]
New Go implementation by user [programming-idioms.org]
↷
Version 7
2020-03-17, 13:34:10
Version 8
2020-03-20, 17:23:38
Idiom #207 allocate a list that is automatically deallocated
Allocate a list / array a containing n elements (n assumed to be too large for a stack) that is automatically deallocated when the program exits the scope it is declared in.
Idiom #207 allocate a list that is automatically deallocated
Allocate a list / array a containing n elements (n assumed to be too large for a stack) that is automatically deallocated when the program exits the scope it is declared in.
Comments bubble
a is garbage-collected after the program exits its scope, unless we let it "escape" by taking its reference.
The runtime decides if a lives in the stack on in the heap.