Skip to content

Commit

Permalink
allow cache as argument name
Browse files Browse the repository at this point in the history
fixes #28
  • Loading branch information
marius311 committed Jun 15, 2023
1 parent 7d183e2 commit 3ab007e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Memoization"
uuid = "6fafb56a-5788-4b4e-91ca-c0cea6611c73"
authors = ["Marius Millea <[email protected]>"]
version = "0.2"
version = "0.2.1"

[deps]
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Expand Down
6 changes: 3 additions & 3 deletions src/Memoization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ end


function _memoized_call(cache_constructor, cacheid_get, getter_body, args, kwargs)
T, getter = gensym.(("T","getter"))
T, getter, cache = gensym.(("T","getter","cache"))
quote
cache = $get_cache($cache_constructor, $cacheid_get)
$cache = $get_cache($cache_constructor, $cacheid_get)
($getter)() = $getter_body
$T = $(Core.Compiler.return_type)($getter, $Tuple{})
$_get!($getter, cache, (($(args...),), ($(kwargs...),))) :: $T
$_get!($getter, $cache, (($(args...),), ($(kwargs...),))) :: $T
end
end

Expand Down

2 comments on commit 3ab007e

@marius311
Copy link
Owner Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/85681

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.1 -m "<description of version>" 3ab007e2cb9722a6b62696b4e9fd0fa865b1420b
git push origin v0.2.1

Please sign in to comment.