Stefan_Salewski:

> May it be possible to have one single Seq in each proc on the stack? Of 
> course it has to be the last element, and can only work when that proc do not 
> call other procs.

That may be possible, but far too complicated with far too few impact on 
performance. The compiler would need to properly place the seq, statically 
analyze that no other procs are called, and add special transformation code 
every time you copy this seq. If you have, somewhere in your proc, some code 
`a.b`, where `b` is some field in `a``s type, and you transform ``b` into a 
getter proc at some point in the future, you code suddenly wouldn't be able to 
compile anymore. And this is just one example why it is a really bad idea.

Ada is the one language I know which went a long way for arrays of dynamic 
length which can still be stored on the stack. The only restriction is that an 
array cannot change size after initialization. Therefore, it does not cover all 
use cases and it still needs dynamic container types in its standard library. 
Also, handling those arrays is a bit more difficult than in other programming 
languages. Everything comes at a price.

Reply via email to