You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Rust, the iterator method fuse exists. It returns an iterator that will keep returning None after the first None. But while in Rust, Iterator's [next] method returns an Option, in Javascript next returns a value and a done flag, that indicates the end of the iterator. Because of this, Javascript's iterator are semantically already fused, rendering the method fuse useless. Although it could be used to turn an iterator over Option<T> (alias for T | null in our codebase), I think it wouldn't be semantically the same with Rust's fuse. Besides that, given the lack of generic specialization in Typescript, implementing it this way would be problematic.
Should the fuse method be implemented, then?
The text was updated successfully, but these errors were encountered:
In Rust, the iterator method fuse exists. It returns an iterator that will keep returning
None
after the firstNone
. But while in Rust, Iterator's [next] method returns anOption
, in Javascript next returns a value and adone
flag, that indicates the end of the iterator. Because of this, Javascript's iterator are semantically already fused, rendering the methodfuse
useless. Although it could be used to turn an iterator overOption<T>
(alias forT | null
in our codebase), I think it wouldn't be semantically the same with Rust'sfuse
. Besides that, given the lack of generic specialization in Typescript, implementing it this way would be problematic.Should the
fuse
method be implemented, then?The text was updated successfully, but these errors were encountered: