You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been working on automatic type checking in Splipy. This is quite challenging, because Splipy has been written to be extremely lenient in terms of types, and many functions return one of several different types based on input parameters. For example, SplineObject.split is a particularly egregious offender: it returns either a list of objects or (if the original object is periodic) only a single object. Since there's no way to encode whether an object is periodic or not in the type system, it's impossible for a type checker to know whether .split returns a list of objects or a single object in any particular case (even though the programmer does!).
I propose to phase out those functions and replace them with more stable alternatives. We can potentially leave behind the incriminating function to prevent destroying existing code, but I don't want to use them in Splipy if at all possible.
In this issue I will list out each relevant case as I find them.
BSplineBasis.evaluate returns either a sparse array or a dense array. The sparse code path is more general.
BSPlineBasis.continuity returns either an int or a float. It is convenient to pretend it's always an int. What to do?
SplineObject.section sometimes returns an array, sometimes a spline object.
SplineObject.split sometimes returns a list, sometimes only one object.
SplineObject.tangent, when called without a direction, returns a tuple of arrays (one for each direction) - except for Curves.
Curve.curvature returns a float when there's only a single input parameter - most other such functions return a float only when there's a single input parameter that is not in a list.
Curve.torsion: same problem.
The text was updated successfully, but these errors were encountered:
I have been working on automatic type checking in Splipy. This is quite challenging, because Splipy has been written to be extremely lenient in terms of types, and many functions return one of several different types based on input parameters. For example,
SplineObject.split
is a particularly egregious offender: it returns either a list of objects or (if the original object is periodic) only a single object. Since there's no way to encode whether an object is periodic or not in the type system, it's impossible for a type checker to know whether.split
returns a list of objects or a single object in any particular case (even though the programmer does!).I propose to phase out those functions and replace them with more stable alternatives. We can potentially leave behind the incriminating function to prevent destroying existing code, but I don't want to use them in Splipy if at all possible.
In this issue I will list out each relevant case as I find them.
BSplineBasis.evaluate
returns either a sparse array or a dense array. The sparse code path is more general.BSPlineBasis.continuity
returns either an int or a float. It is convenient to pretend it's always an int. What to do?SplineObject.section
sometimes returns an array, sometimes a spline object.SplineObject.split
sometimes returns a list, sometimes only one object.SplineObject.tangent
, when called without a direction, returns a tuple of arrays (one for each direction) - except for Curves.Curve.curvature
returns a float when there's only a single input parameter - most other such functions return a float only when there's a single input parameter that is not in a list.Curve.torsion
: same problem.The text was updated successfully, but these errors were encountered: