marius311 / Memoization.jl

Easily and efficiently memoize any function, closure, or callable object in Julia.
MIT License
96 stars 2 forks source link

[BUG] Docstring Not Working on `@memoize`'d Function #22

Closed TheCedarPrince closed 2 years ago

TheCedarPrince commented 2 years ago

Hi @marius311 ,

If I have the following definition for a function:

"""
    VisitFilterPersonIDs(; visit_codes::Vector{Int64}, tab::SQLTable = visit_occurrence)

Given a list of visit concept IDs, `visit_codes` (i.e. valid IDs from `visit_concept_id`), return from the database individuals having at least one entry in the Visit Occurrence table matching at least one of the provided visit types.

# Keyword Arguments:

- `visit_codes` - 
"""
@memoize Dict function VisitFilterPersonIDs(visit_codes::Vector{Int64}; tab::SQLTable = visit_occurrence)

The function here does not have the associated docstring recorded. Why is this happening? It seems like a bug but I am not sure. Thanks!

marius311 commented 2 years ago

I was unable to reproduce this, it should work, e.g.:

julia> """
       docstring
       """ @memoize Dict foo() = 1
foo

help?> foo
search: foo floor pointer_from_objref OverflowError RoundFromZero unsafe_copyto! functionloc StackOverflowError @functionloc

  docstring
TheCedarPrince commented 2 years ago

Hey @marius311 ,

I must've somehow broken my dev environment at the time of this issue being created. I just restarted my Julia session and checked the docs mode on the REPL and sure enough, it works! False alarm - bug with me, not with package!

Thanks for looking into this!

~ tcp 🌳