Interesting! If I understand you correctly, I should make a SplineType type 
with a handler field to hold the eval proc. And then newHermiteSpline() would 
return a SplineType with handler set to the Hermite's eval proc. Have I 
understood you correctly then?

> How would you go about accessing the other variables of the Node in your 
> case? When you call the backward proc you would have to do something like 
> this right?:
    
    
    node.backward(node.gate, node.payload)
    
    
    Run

Could that be shortened down to something that resembles node.backward()? A 
template could work I'd guess, something along the lines of: 
    
    
    template eval*[T](spline: SplineType[T], x: float): untyped =
      spline.handler(spline.X, spline.coeffs, x)
    template eval*[T](spline: SplineType[T], x: openArray[float]): untyped =
      spline.handler_seq(spline.X, spline.coeffs, x)
    
    
    Run

Could this work or did you have anything different in mind? :-)

Reply via email to