The feature in OxCaml that more languages should steal (theconsensus.dev) 6 points by g0xA52A2A 16d ago ↗ HN
[–] weissi 15d ago ↗ Swift has `@_noAllocation`:@_noAllocation func foo() -> Int { return [1,2,3].randomElement()! } fails with "error: Using type 'Int' can cause metadata allocation or locks"but@_noAllocation func foo() -> Int { return 1 + 2 + 3 }compiles fine.
2 comments
[ 2.9 ms ] story [ 17.6 ms ] thread@_noAllocation func foo() -> Int { return [1,2,3].randomElement()! } fails with "error: Using type 'Int' can cause metadata allocation or locks"
but
@_noAllocation func foo() -> Int { return 1 + 2 + 3 }
compiles fine.