Skip to content

[stm] remove initNow and introduce initWith#997

Merged
fwbrasil merged 2 commits into
mainfrom
stm-initnow-initwith
Jan 10, 2025
Merged

[stm] remove initNow and introduce initWith#997
fwbrasil merged 2 commits into
mainfrom
stm-initnow-initwith

Conversation

@fwbrasil
Copy link
Copy Markdown
Collaborator

Following up on #959 (comment) and #984


for
map <- TMap.initNow[Int, Int]()
map <- TMap.init[Int, Int]
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've added an overload with empty params

* @return
* The result of applying the function to the new TMap, within combined IO and S effects
*/
inline def initWith[K, V](inline entries: (K, V)*)[A, S](inline f: TMap[K, V] => A < S)(
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I took the opportunity to optimize this method by using unsafe operations to initialize the TRefs

@fwbrasil fwbrasil merged commit 67a43c6 into main Jan 10, 2025
@fwbrasil fwbrasil deleted the stm-initnow-initwith branch January 10, 2025 23:53
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.

2 participants