Skip to content

Commit

Permalink
const ref for (global) module variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jbcaillau committed Jun 21, 2024
1 parent 3f144ca commit 94cfda4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/default.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
__default_AD_backend = AutoForwardDiff()
const __default_AD_backend = Ref(AutoForwardDiff())

function set_AD_backend(AD)
global __default_AD_backend = AD
global __default_AD_backend[] = AD
nothing
end

Expand All @@ -13,7 +13,7 @@ Used to set the default value of Automatic Differentiation backend.
The default value is `AutoForwardDiff()`, that is the `ForwardDiff` package is used by default.
"""
__get_AD_backend() = __default_AD_backend # default AD backend
__get_AD_backend() = __default_AD_backend[] # default AD backend

"""
$(TYPEDSIGNATURES)
Expand Down

0 comments on commit 94cfda4

Please sign in to comment.