-
Notifications
You must be signed in to change notification settings - Fork 161
Description
The tuples and arrays as they are presented in Chapter 7 of the book are a little unsatisfactory in that their sizes are all known at compile-time and could all be stored on the stack instead of the heap.
My suggestion would be to add a new array creation expression "newArray(size, init)" where size is an integer-typed expression and init is a value with which all array elements get initialized (through a while loop). That would necessitate to generalize "collect" and "Allocate" in the intermediate languages to accept an expression/atom as the size argument instead of a fixed integer, but that would be easy.
It would be a simple extension that would convincingly drive home the message that we really need heap allocation, garbage collection, and all that jazz.