invenia / invenia/Checkpoints.jl

Making checkpoint a macro

Open
#20 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
12
Forks
4
PR merge metrics
No merged PRs in 30d

Description

We might likely to make `checkpoint` into a macro

Reasons for macro:
- the main reason: we can use this to set things up such that if a checkpoint isn’t enabled then functions that it calls to store their values are not called, which could be expensive. `@checkpoint("RegressionSummary", value=expensive_summary_function(foo))`. (This is what the Base Logging macros do)
- We can get rid of the need to `register` them in `__init__` by making it, at parse time `register` it. (not 100% sure if this will work, since it is mutating a global variable at parse time, I think it does. If it doens’t then shouldn’t do this)
- We can also automatically have also record the names of all the things it is saving, and then the user can query that with a function like `checkpoint_info` that would print a list. As a kind of documentation.
- We can store the filename and line number (if we a really clever we can store the exact git commit and then we will be able to generate a link to that file and line, I had a proof of concept for this ages ago) so can lookup afterwards where it is from.
- we can do like bases logging macros and have just writing `a` be the same as `:a=>a` (though we also get this if we changes to storing data in the kwarg position https://github.com/invenia/Checkpoints.jl/issues/16)

On the otherhand macros are harder to reason about. so the gains might not be worth it.
I think low priority

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.