22#  AbstractConfig #
33# #################
44
5- @compat   abstract type  AbstractConfig end 
5+ abstract type  AbstractConfig end 
66
77Base. show (io:: IO , cfg:: AbstractConfig ) =  print (io, typeof (cfg). name)
88
99# #################
1010#  GradientConfig #
1111# #################
1212
13- @compat  immutable  GradientConfig{I} <:  AbstractConfig 
13+ struct  GradientConfig{I} <:  AbstractConfig 
1414    input:: I 
1515    tape:: InstructionTape 
1616    #  disable default outer constructor
17-     ( :: Type{ GradientConfig{I}} ){I} (input, tape) =  new {I} (input, tape)
17+     GradientConfig {I} (input, tape)  where  {I}  =  new {I} (input, tape)
1818end 
1919
2020#  "private" convienence constructor
21- _GradientConfig {I} (input:: I , tape:: InstructionTape ) =  GradientConfig {I} (input, tape)
21+ _GradientConfig (input:: I , tape:: InstructionTape )  where  {I}  =  GradientConfig {I} (input, tape)
2222
2323""" 
2424    ReverseDiff.GradientConfig(input, tp::InstructionTape = InstructionTape()) 
@@ -32,7 +32,7 @@ the target function's output.
3232
3333See `ReverseDiff.gradient` for a description of acceptable types for `input`. 
3434""" 
35- GradientConfig {T} (input:: AbstractArray{T} , tp:: InstructionTape  =  InstructionTape ()) =  GradientConfig (input, T, tp)
35+ GradientConfig (input:: AbstractArray{T} , tp:: InstructionTape  =  InstructionTape ())  where  {T}  =  GradientConfig (input, T, tp)
3636
3737GradientConfig (input:: Tuple , tp:: InstructionTape  =  InstructionTape ()) =  GradientConfig (input, eltype (first (input)), tp)
3838
@@ -42,28 +42,28 @@ GradientConfig(input::Tuple, tp::InstructionTape = InstructionTape()) = Gradient
4242Like `GradientConfig(input, tp)`, except the provided type `D` is assumed to be the element 
4343type of the target function's output. 
4444""" 
45- function  GradientConfig {D} (input:: Tuple , :: Type{D} , tp:: InstructionTape  =  InstructionTape ())
45+ function  GradientConfig (input:: Tuple , :: Type{D} , tp:: InstructionTape  =  InstructionTape ())  where  D 
4646    return  _GradientConfig (map (x ->  track (similar (x), D, tp), input), tp)
4747end 
4848
49- function  GradientConfig {D} (input:: AbstractArray , :: Type{D} , tp:: InstructionTape  =  InstructionTape ())
49+ function  GradientConfig (input:: AbstractArray , :: Type{D} , tp:: InstructionTape  =  InstructionTape ())  where  D 
5050    return  _GradientConfig (track (similar (input), D, tp), tp)
5151end 
5252
5353# #################
5454#  JacobianConfig #
5555# #################
5656
57- @compat  immutable  JacobianConfig{I,O} <:  AbstractConfig 
57+ struct  JacobianConfig{I,O} <:  AbstractConfig 
5858    input:: I 
5959    output:: O 
6060    tape:: InstructionTape 
6161    #  disable default outer constructor
62-     ( :: Type{ JacobianConfig{I,O}} ){I,O} (input, output, tape) =  new {I,O} (input, output, tape)
62+     JacobianConfig {I,O} (input, output, tape)  where  {I,O}  =  new {I,O} (input, output, tape)
6363end 
6464
6565#  "private" convienence constructor
66- _JacobianConfig {I,O} (input:: I , output:: O , tape:: InstructionTape ) =  JacobianConfig {I,O} (input, output, tape)
66+ _JacobianConfig (input:: I , output:: O , tape:: InstructionTape )  where  {I,O}  =  JacobianConfig {I,O} (input, output, tape)
6767
6868""" 
6969    ReverseDiff.JacobianConfig(input, tp::InstructionTape = InstructionTape()) 
@@ -99,14 +99,14 @@ stored or modified in any way.
9999
100100See `ReverseDiff.jacobian` for a description of acceptable types for `input`. 
101101""" 
102- function  JacobianConfig {D} (output:: AbstractArray{D} , input:: Tuple , tp:: InstructionTape  =  InstructionTape ())
102+ function  JacobianConfig (output:: AbstractArray{D} , input:: Tuple , tp:: InstructionTape  =  InstructionTape ())  where  D 
103103    cfg_input =  map (x ->  track (similar (x), D, tp), input)
104104    cfg_output =  track! (similar (output, TrackedReal{D,D,Void}), output, tp)
105105    return  _JacobianConfig (cfg_input, cfg_output, tp)
106106end 
107107
108108#  we dispatch on V<:Real here because InstructionTape is actually also an AbstractArray
109- function  JacobianConfig {D,V<:Real} (output:: AbstractArray{D} , input:: AbstractArray{V} , tp:: InstructionTape  =  InstructionTape ())
109+ function  JacobianConfig (output:: AbstractArray{D} , input:: AbstractArray{V} , tp:: InstructionTape  =  InstructionTape ())  where  {D,V <: Real } 
110110    cfg_input =  track (similar (input), D, tp)
111111    cfg_output =  track! (similar (output, TrackedReal{D,D,Void}), output, tp)
112112    return  _JacobianConfig (cfg_input, cfg_output, tp)
@@ -123,7 +123,7 @@ JacobianConfig(result::DiffResult, input, tp::InstructionTape) = JacobianConfig(
123123#  HessianConfig #
124124# ################
125125
126- immutable  HessianConfig{G<: GradientConfig ,J<: JacobianConfig } <:  AbstractConfig 
126+ struct  HessianConfig{G<: GradientConfig ,J<: JacobianConfig } <:  AbstractConfig 
127127    gradient_config:: G 
128128    jacobian_config:: J 
129129end 
149149Like `HessianConfig(input, tp)`, except the provided type `D` is assumed to be the element 
150150type of the target function's output. 
151151""" 
152- function  HessianConfig {D} (input:: AbstractArray , :: Type{D} , gtp:: InstructionTape  =  InstructionTape (), jtp:: InstructionTape  =  InstructionTape ())
152+ function  HessianConfig (input:: AbstractArray , :: Type{D} , gtp:: InstructionTape  =  InstructionTape (), jtp:: InstructionTape  =  InstructionTape ())  where  D 
153153    jcfg =  JacobianConfig (input, D, jtp)
154154    gcfg =  GradientConfig (jcfg. input, gtp)
155155    return  HessianConfig (gcfg, jcfg)
0 commit comments