Open
Conversation
3255745 to
f41aa29
Compare
hearnadam
reviewed
Mar 12, 2026
| opaque type Slot[+V] = V | AnyRef | Null | ||
|
|
||
| object Slot: | ||
| val empty: Slot[Nothing] = null |
Collaborator
There was a problem hiding this comment.
Is there a reason this isn't a new AnyRef?
| * @return | ||
| * A memoized version of the function | ||
| */ | ||
| def memo[A]( |
Collaborator
There was a problem hiding this comment.
I can think of use cases that would require multiple functions, but may produce the same value. Do you think we could support that?
| if promise.unsafe.interrupt() then | ||
| store.remove(v) | ||
| } { | ||
| Abort.run[Throwable](f(v)).map { |
Collaborator
There was a problem hiding this comment.
Do we need to run Abort[Any] to support any type of failure?
Suggested change
| Abort.run[Throwable](f(v)).map { | |
| Abort.runWith[Throwable](f(v)) { |
| promise.unsafe.completeDiscard(Result.Success(v)) | ||
| v | ||
| } | ||
| case r: Result.Error[Nothing] @unchecked => |
Collaborator
There was a problem hiding this comment.
Shouldn't this be?
Suggested change
| case r: Result.Error[Nothing] @unchecked => | |
| case r: Result.Error[Throwable] @unchecked => |
| val s = values.get(slot) | ||
| if s.isLocked then | ||
| // Slot being written — restart | ||
| add(key, value) |
Collaborator
There was a problem hiding this comment.
This will re-acquire the hashcode of the key. Should that be avoidable?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We currently depend on Caffeine in kyo-cache, which can't be reused in JS and Native. This PR introduces a new
Cacheprimitive inkyo-corewith the safe and unsafe APIs pattern. Please see scaladocs for more information on the design.