Open nomeata opened 2 years ago
It is worse. We should make this public func fromArray<A>(xs : [A]) : Iter<A> = xs.vals();
and deprecate it. I suspect that the for
loop optimisation I have implemented recently won't kick in for fromArray
.
Not sure we need to deprecate it; I think a nice, consistent and discoverable API is more important that an optimization – and we have plenty of optimization thwarted by unnecessary function indirections, just think of all the numeric operations. Maybe a simple inlining optimization for functions with very simple bodies would be useful.
I’d keep the function, adjust the implementation, and maybe mention in the docs that it is nothing else than the .vals()
function.
We currently have
but doesn’t that simply re-implement
xs.vals()
? Why not use that in this function?