we should only box in the specific case where the size of the closure cannot be known. Usually we do statically know the size, and can pass the captured values in an unboxed way. From what I understand, morphic is smart enough to make this distinction.
@exists-forall pointed out that the Roc equivalent of this pseudocode likely has a bug:
(where
x
,y
, andz
are being closed over)The problem is that the size of the closure returned by
compose
depends on the length of the list, which can't be known until runtime.Morphic solved this by boxing the closed-over data returned by (a function like)
compose
, which is likely what Roc should do too.