Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@guizmaii
Copy link
Member

No description provided.

if (iterator.hasNextAt(index)) {
val a = iterator.nextAt(index)
index += 1
def loop(iterator: Chunk.ChunkIterator[A]): ZIO[R, E, Option[A]] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be changed to use a lazy val instead:

lazy val loop: ZIO[R, E, Option[A]]

PS: I'm actually not sure which one would be better performance-wise. lazy vals require a volatile read, however in Scala 3 we could use the @threadUnsafe annotation for such use-cases which use plain vars in the implementation. As for Scala 2, we'd have to stub it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kyri-petrou What do you think about doing this in another PR, maybe? It seems a quite bigger change

@guizmaii guizmaii merged commit f0b8355 into series/2.x Apr 14, 2025
18 checks passed
@guizmaii guizmaii deleted the opt_Chunk_findZIO branch April 14, 2025 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants