@@ -60,8 +60,8 @@ pub inline fip fun vec/ensure-unique(v: vector<a>): vector<a>
6060 if v. unsafe-is-unique then v else v. unsafe-copy
6161
6262// Copies the vector
63- // This is technically not fip, but we pretend it to be, since it will only copy when non-unique
64- // ( only used for ` ensure-unique` which satisfies the non-unique precondition)
63+ // This is technically not fip, which is why we call it `unsafe-copy`.
64+ // However, we pretend it to be fip, since it is only called from `vec/ ensure-unique` which will only copy if non-unique
6565inline fip extern unsafe-copy (v : vector < a> ): vector < a>
6666 c "kk_vector_copy "
6767 js inline "[...(#1)] "
@@ -88,14 +88,14 @@ pub inline extern assign/@index( ^self : local-var<h,vector<a>>, ^index : int, a
8888// Assign to an entry in a local `:vector` variable.
8989pub inline fun assign/ update ( ^ self : local-var < h, vector < a> > , ^ index : int , f : a -> < local < h> ,div > a ) : < local < h> ,div > ()
9090 val i = index. ssize_t
91- // TODO: Somehow get rid of div & allow linear effects
91+ // Future TODO: Somehow get rid of div & allow linear effects
9292 ensure-unique(std/core/types/ @byref(self))
9393 val x = self. unsafe-extract(i)
9494 val res = f(x)
9595 self[index] := res
9696
9797// Ensures that a vector in a local variable is unique
98- // TODO: Remove div (need hdiv constraint)
98+ // Future TODO: Remove div (need hdiv constraint propagation )
9999pub inline fun local/ ensure-unique (^ v : local-var < h, vector < a> > ): < local < h> ,div > ()
100100 if v. unsafe-is-unique then () else v := unsafe-copy(v)
101101
0 commit comments