Andrei Alexandrescu:
> The conundrum is that a type system can't say that T[N] has some 
> semantics for N <= Nmax and some other semantics for N > Nmax. So we 
> need to pick one, and probably picking the value semantics is the right 
> thing to do.

Well, I think the type system can be extended to manage that: the programmer 
may specify an optional compiler command line argument like:
-ms 128
Now all structs/static arrays more than 128 bytes long are passed by reference 
:-)

Alternative solution, less extreme: instead of changing the value/ref pass 
semantics, when you add such optional command line argument the compiler gives 
you a compilation warning (or even error, if you want) everywhere you try to 
pass by value struct or static array more than 128 bytes long.

Bye,
bearophile

Reply via email to