Skip to content

sort evaluated arguments in formals' order to ensure cache hit #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

bluaze
Copy link

@bluaze bluaze commented May 10, 2019

when the function has multiple default arguments or the default argument is not defined at the end of formal list, whether the default values are passed explicitly (by call) or implicitly (by default mechanism) may matter

fn <- function(x = 1, y = 1)
fm <- memoise(fn)

fm(x = 1)
fm(y = 1)

the last 2 call are essentially same, but would have called fn twice. that is because default values are attached to args ignoring their order in formals. sort them in original order would solve this.

@codecov-io
Copy link

Codecov Report

Merging #89 into master will decrease coverage by 16.24%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #89       +/-   ##
===========================================
- Coverage   77.37%   61.13%   -16.25%     
===========================================
  Files           5        5               
  Lines         221      229        +8     
===========================================
- Hits          171      140       -31     
- Misses         50       89       +39
Impacted Files Coverage Δ
R/memoise.R 100% <100%> (ø) ⬆️
R/cache_s3.R 0% <0%> (-100%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1650ad7...281c540. Read the comment docs.

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