-
Notifications
You must be signed in to change notification settings - Fork 471
Closed
Labels
staleOld issues that went staleOld issues that went stale
Description
Following #4605, we can already benefit such code path:
let [@inline] forEachU a f =
for i = 0 to Array.length a - 1 do
f (Array.unsafe_get a i) [@bs]
done
;; forEachU [|1;2;3|] (fun [@bs] x -> Js.log x)
We should make sure that the cross module also works for such patterns in a conservative way to make it more meaningful.
Note this also works which is pretty cool, generating beautiful code:
let [@inline] forEach a f =
for i = 0 to Array.length a - 1 do
f (Array.unsafe_get a i)
done
;; forEach [|1;2;3|] Js.log
var a = [
1,
2,
3
];
for(var i = 0 ,i_finish = a.length; i < i_finish; ++i){
console.log(a[i]);
}
fhammerschmidt
Metadata
Metadata
Assignees
Labels
staleOld issues that went staleOld issues that went stale