Skip to content

Conversation

@c42f
Copy link
Contributor

@c42f c42f commented Oct 5, 2020

Create method of generated_callfunc in the user's module so that any global symbols within the body will be looked up in the user's module scope.

This is straightforward but a bit clunky. A neater solution might be to explicitly expand in the user's module and return a CodeInfo from generated_callfunc, but it seems we'd need jl_expand_and_resolve which doesn't exist until Julia 1.3 or so. See:

c42f added 3 commits October 5, 2020 13:22
Create method of `generated_callfunc` in the user's module so that any
global symbols within the body will be looked up in the user's module
scope.

This is straightforward but clunky.  A neater solution should be to
explicitly expand in the user's module and return a CodeInfo from
`generated_callfunc`, but it seems we'd need `jl_expand_and_resolve`
which doesn't exist until Julia 1.3 or so. See:

* JuliaLang/julia#32902
* https://github.com/NHDaly/StagedFunctions.jl/blob/master/src/StagedFunctions.jl#L30
The syntax RuntimeGeneratedFunctions.init(user_mod) is less cute but
more general way to name the initialization function. (The need to
initialize data structures in user modules isn't entirely unique to
RuntimeGeneratedFunctions.)
@codecov
Copy link

codecov bot commented Oct 5, 2020

Codecov Report

Merging #12 into master will decrease coverage by 2.10%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #12      +/-   ##
==========================================
- Coverage   92.10%   90.00%   -2.11%     
==========================================
  Files           1        1              
  Lines          38       40       +2     
==========================================
+ Hits           35       36       +1     
- Misses          3        4       +1     
Impacted Files Coverage Δ
src/RuntimeGeneratedFunctions.jl 90.00% <50.00%> (-2.11%) ⬇️

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 bbfaf60...3ab1da5. Read the comment docs.

@ChrisRackauckas ChrisRackauckas merged commit c4801a6 into SciML:master Oct 5, 2020
@c42f c42f deleted the cjf/global-lookup-fix branch October 5, 2020 21:15
@c42f c42f restored the cjf/global-lookup-fix branch October 5, 2020 21:15
@c42f c42f deleted the cjf/global-lookup-fix branch October 5, 2020 21:15
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