8000 GitHub - oxinabox/MistyClosures.jl
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

oxinabox/MistyClosures.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MistyClosures

Build Status Code Style: Blue ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

Marginally less opaque closures.

Specifically, a MistyClosure is comprises an OpaqueClosure and an IRCode. This is useful if you generate an OpaqueClosure from an IRCode, and want to be able to retrieve the IRCode later on.

Recommended Use

# Get the `IRCode` associated to `sin(5.0)`.
ir = Base.code_ircode_by_type(Tuple{typeof(sin), Float64})[1][1]

# Produce a `MistyClosure` using it. All kwargs are passed to the `OpaqueClosure`
# constructor.
mc = MistyClosure(ir; do_compile=true)

# Call it.
mc(5.0) == sin(5.0)

Alterative Use

Sometimes you'll already have an OpaqueClosure lying around, and not want to produce a new one from an IRCode (as this often takes a surprisingly large amount of time). If ths is the case, you can simply use the default constructor for MistyClosure. That is, write

mc = MistyClosure(existing_opaque_closure, ir)

Of course, it is your responsibility so ensure that ir and existing_opaque_closure are in agreement.

4C66

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Julia 100.0%
0