Open mneumann opened 1 year ago
We do not yet have "recover" blocks as in Pony, or proper region analysis that would be used to construct such a feature.
As a result, the only way to create an Array'iso
or Array'val
literal, is to ensure that each element has a sendable cap. If that condition is met, then any array literal which is being "assigned to" something of a val
or iso
type will be automatically lifted to a val
or iso
array literal.
In this case, your example failed only because Pair.new
creates ref
objects.
In lieu of recover blocks, this problem can be sidestepped by adding a val
and/or iso
constructor to the Pair
type.
When I write e.g.
[Pair(String).new("a", b"), ...]
I get anArray'ref
, but how do I turn this into aArray'val
? On the callee side, I can use an argument typeArray'box
which works fine, though just curious, if the argument type would beArray'val
, how would I create an Array literal asArray'val
?