Skip to content

Commit ebe8f91

Browse files
committed
Remove more references to dynamic scope
1 parent 01a0b34 commit ebe8f91

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Libtask Testing](https://github.com/TuringLang/Libtask.jl/workflows/Libtask%20Testing/badge.svg)](https://github.com/TuringLang/Libtask.jl/actions?branch=main)
44

55

6-
Resumable and copyable functions in Julia, with optional dynamic scope.
6+
Resumable and copyable functions in Julia, with optional function-specific globals.
77
See the docs for example usage.
88

99
Used in the [Turing](https://github.com/TuringLang/Turing.jl) probabilistic programming language to implement various particle-based inference methods, for example those in [AdvancedPS.jl](https://github.com/TuringLang/AdvancedPS.jl/).

src/copyable_task.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
"""
22
get_taped_globals(T::Type)
33
4-
Returns the dynamic scope associated to `Libtask`. If called from inside a `TapedTask`, this
5-
will return whatever is contained in its `taped_globals` field.
4+
When called from inside a call to a `TapedTask`, this will return whatever is contained in
5+
its `taped_globals` field.
66
77
The type `T` is required for optimal performance. If you know that the result of this
88
operation must return a specific type, specific `T`. If you do not know what type it will
99
return, pass `Any` -- this will typically yield type instabilities, but will run correctly.
1010
1111
See also [`set_taped_globals!`](@ref).
1212
"""
13-
get_taped_globals(::Type{T}) where {T} = typeassert(task_local_storage(:task_variable), T)
13+
@noinline get_taped_globals(::Type{T}) where {T} =
14+
typeassert(task_local_storage(:task_variable), T)
1415

1516
__v::Int = 5
1617

0 commit comments

Comments
 (0)