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
The problem is that a call to the method Intervals.translate(Interval interval, long... translation) with two arguments is overloaded by the method Intervals.translate(Interval interval, long shift, int dim).
So a user that writes:
Intervals.translate(interval, 4, 5)
isn't sure which method is called, and what the result actually means. There's the idea to rename the method to Intervals.translateDim(Interval interval, long shift, int dim). At the same time Intervals.translate(Interval interval, long shift, int dim) should not be removed, but be deprecated, throw an Exception, have another return type maybe void. Such that code which uses this method notices the problem and is fixed. Otherwise a very subtle bug will be introduced.
There's a similar problem with Intervals.expand and Views.hyperSlice. Views.permuteCoordinates might also be worth looking at.
The title is fine, but in the description you write
At the same time Views.translate(Interval interval, long shift, int dim) should not be removed
But there is no Views.translate(Interval interval, long shift, int dim), there is only Intervals.translate(Interval interval, long shift, int dim) -- as you noted yourself in #238 (comment) 🤔
The problem is that a call to the method
Intervals.translate(Interval interval, long... translation)
with two arguments is overloaded by the methodIntervals.translate(Interval interval, long shift, int dim)
.So a user that writes:
isn't sure which method is called, and what the result actually means. There's the idea to rename the method to
Intervals.translateDim(Interval interval, long shift, int dim)
. At the same timeIntervals.translate(Interval interval, long shift, int dim)
should not be removed, but be deprecated, throw an Exception, have another return type maybe void. Such that code which uses this method notices the problem and is fixed. Otherwise a very subtle bug will be introduced.There's a similar problem with
Intervals.expand
andViews.hyperSlice
.Views.permuteCoordinates
might also be worth looking at.The problem is mentioned in #238
The text was updated successfully, but these errors were encountered: