Skip to content

Commit c42a953

Browse files
committed
rename unwrap_wirtinger -> unthunk
1 parent 20e7134 commit c42a953

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/differentials.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ wrapped by `x`, such that mutating `extern(x)` might mutate `x` itself.
4747

4848
abstract type AbstractWirtinger <: AbstractDifferential end
4949

50-
unwrap_wirtinger(x) = x
51-
5250
wirtinger_primal(x) = x
5351
wirtinger_conjugate(::Any) = Zero()
5452

@@ -209,12 +207,13 @@ end
209207
return element, (externed, new_state)
210208
end
211209

212-
unwrap_wirtinger(x::Union{Casted,AbstractThunk}) = unwrap_wirtinger(extern(x))
210+
unthunk(x) = x
211+
unthunk(x::AbstractThunk) = unthunk(x())
213212

214-
wirtinger_primal(x::Union{Casted,AbstractThunk}) =
215-
throw(ArgumentError("`wirtinger_primal` is not defined for $(typeof(x)). Call `unwrap_wirtinger` first"))
216-
wirtinger_primal(x::Union{Casted,AbstractThunk}) =
217-
throw(ArgumentError("`wirtinger_conjugate` is not defined for $(typeof(x)). Call `unwrap_wirtinger` first"))
213+
wirtinger_primal(::Union{AbstractThunk}) =
214+
throw(ArgumentError("`wirtinger_primal` is not defined for `AbstractThunk`. Call `unthunk` first."))
215+
wirtinger_conjugate(::Union{AbstractThunk}) =
216+
throw(ArgumentError("`wirtinger_primal` is not defined for `AbstractThunk`. Call `unthunk` first."))
218217

219218
#####
220219
##### `Thunk`

0 commit comments

Comments
 (0)