forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opaque_closure.jl
26 lines (21 loc) · 866 Bytes
/
opaque_closure.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# This file is a part of Julia. License is MIT: https://julialang.org/license
"""
@opaque ([type, ]args...) -> body
Marks a given closure as "opaque". Opaque closures capture the
world age of their creation (as opposed to their invocation).
This allows for more aggressive optimization of the capture
list, but trades off against the ability to inline opaque
closures at the call site, if their creation is not statically
visible.
An argument tuple type (`type`) may optionally be specified, to
specify allowed argument types in a more flexible way. In particular,
the argument type may be fixed length even if the function is variadic.
!!! warning
This interface is experimental and subject to change or removal without notice.
"""
macro opaque(ex)
esc(Expr(:opaque_closure, ex))
end
macro opaque(ty, ex)
esc(Expr(:opaque_closure, ty, ex))
end