rename ref.modify -> ref.access#694
Conversation
|
I'm a bit worried about the docs for this because the vector use case mentioned isn't really accurate, we need something like #716 or #550 for vectors to be able to update in-place. This only puts the ref into a local scope, which prevents escaping the scope, nothing else as far as I can tell. Maybe a better name for this would be |
|
I think those names work (though Regarding the docs, what's the core difference? IIUC it's that using |
|
Yeah, that is the core difference. Access only makes the |
2c83d90 to
00399ab
Compare
This caused me some confusion when I was getting started, particularly because
ref.modify { x => x + 1 }is exactly how you would increment a Ref[Int] in scala's cats-effect, but produces surprising results in koka.When I found out how it worked I thought
accessseems like a more neutral name, since it allows reading & writing, whereas to memodifyis misleading because I assumed it would always modify the ref.I've left
modifyas a deprecated alias.