Version 0.22.0: Caching probabilities calculation across objects #79
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.
Here's what's new:
probabilities
between objects (closes Cache calculated probabilities across Dice objects #78).Chances.chances
property introduced in v0.21.0More detail on caching:
Use case
Here's an excerpt from that issue:
In the current version,
second
does not need to repeat its calculations, butthird
does. Caching means thatthird
will not need to repeat the calculations. Neither would any otherDice
object that represents 10d4.Disabling caching
Caching is on by default, but it can easily be disabled. There are two ways to disable it, in order to be future-proof:
Basically,
Dice.enableCaching
enables/disables the cache forDice
only, whileDiceKit.enableCaching
sets caching for every type that supports it (currently onlyDice
) and gets whether all caching types have caching enabled. For example:Here's what has to happen:
enableCaching
members (I renamed it a bunch while writing, and I don't think it is correct)Caching
/Cachable
protocol thatDice
conforms toupdateVersion.sh
)release.sh