Arrays are an inherently strict data type. If a lazy right fold is applied, the Symbol.isConcatSpreadable property makes the [x].concat(ys) operation strict in both its arguments. If the symbol is set to false, the following data structure results:
The evaluation function to expand the array can spread the sub arrays into the outermost array. However, this process would be explicit. Many array combinators would need to be modified to implicitly trigger evaluation. An array subclass would be needed.
Fix length
An array subclass could also enforce complete evaluation before accessing length using a smart getter.
Fix index access
This isn't possible with a subtype. A proxy is needed instead, an effort that wouldn't be in proportion with its return.
Conclusion
Reconciliation isn't possible because the result would be quite ineffective.
Arrays are an inherently strict data type. If a lazy right fold is applied, the
Symbol.isConcatSpreadable
property makes the[x].concat(ys)
operation strict in both its arguments. If the symbol is set tofalse
, the following data structure results:Several issues arise:
length
is brokenFix the nesting
The evaluation function to expand the array can spread the sub arrays into the outermost array. However, this process would be explicit. Many array combinators would need to be modified to implicitly trigger evaluation. An array subclass would be needed.
Fix
length
An array subclass could also enforce complete evaluation before accessing
length
using a smart getter.Fix index access
This isn't possible with a subtype. A proxy is needed instead, an effort that wouldn't be in proportion with its return.
Conclusion
Reconciliation isn't possible because the result would be quite ineffective.