JasonBock / SpackleNet

Spackle is a project that contains a number of helper methods I've used to supplement the core classes in .NET.
MIT License
14 stars 1 forks source link

Consider Making `Range<T>` `abstract` #44

Closed JasonBock closed 1 year ago

JasonBock commented 1 year ago

I feel weird with the current implementation of Partition(). What I think I should be doing is having an abstract Range<T> where all of the current work is in the base type, and then I have Partition() as abstract. That would be implemented in IntegralRange<T> and FloatingRange<T>. I could have two static Create() methods where T is further constrained by the two number interfaces, though I'm not sure I can do that.

JasonBock commented 1 year ago

Or, create a IRange<T> where T : INumber<T> interface with members that have default implementations. That way I can keep derivations as struct types.

JasonBock commented 1 year ago

OK, I've tried a bunch of things, and this just isn't going to work very well. So I'm closing the issue.