I’m not happy with the organization of TStreamable and the type polymorphism between TArray and TStream. I propose the following:
TStreamable is gone, TArray and TStream now live under TIterable parallel to TSet, etc.
IR nodes take either a stream or array, but not both.
The only operations interact with arrays are: ToArray, ArrayLength, ArrayLen, ArrayRef and ArraySort (maybe others, I haven’t done a careful audit.) Redundant MakeArray and ArrayRange are gone in favor of the corresponding stream functions.
The remaining Array* functions become Stream* functions. The front end is then responsible for inserting the necessary ToArray and ToStream to make the types work out.