@flyx - c99 (and gcc long before it) have VLAs of the 
fixed-after-initialization variety...mostly syntactic sugar for alloca, of 
course. All that is surely more commonly used than Ada and required no fancy 
containers or any constraints about being a leaf function. Such an array style 
may be different enough from the post-init-resizable Nim seqs to warrant a 
different type, but it could still be an openarray.

I think Nim needs a kind of openarray between array and seq - one which is 
run-time-sized, but fixed after initialization and with backing memory not 
necessarily on the heap. For example, an array of char that is backed by a 
read-only memory mapped file and so cannot be zero-terminated, but being from a 
file its size cannot change after initialization and yet the size can also 
never be known at compile time. Then it could get bounds checking like other 
openarrays and otherwise behave similarly. Maybe that's not the best example, 
but I'm sure there are many more. Lots of times the sizes of things are only 
known at run-time, but don't change once known/computed. Also, many openarray 
accepting routines need not modify their inputs -- why, they cannot change 
lengths of arrays, for example. So, it would be nice if all openarray accepting 
routines could work with such a type, whatever it might be called. Maybe there 
is one and I am just unaware.

Reply via email to