adamreeve / semver.net

Semantic versioning for .NET
MIT License
117 stars 22 forks source link

Logic processing version ranges would be really useful as its own NuGet package #47

Closed brphelps closed 4 years ago

brphelps commented 4 years ago

Both in our project and in some other examples on the web, we have existing SemanticVersion implementations we use (NuGet.Versioning also has its own implementation of a SemanticVersion).

Is there appetite in this project to factor out the range comparison logic (which is sizable and works great!) to either work on an abstraction of a SemanticVersion (e.g. an interface ISemanticVersion or factory ISemanticVersionFactory)?

I'm exploring this as a preferred option to alternatives like copying/pasting code or forking the project.

Thanks!

adamreeve commented 4 years ago

This isn't something I'd do myself but if it really is useful and could be done in a backwards compatible way I'd be happy to accept a PR.

That said, it seems like simply writing your own conversion functions to go from another version type to a SemVer.Version in order to use the range methods would be simpler than introducing an interface, as if you want to interoperate with another type outside of your control like a version from NuGet.Versioning you'd still need some glue code to implement the new interface. So I don't really see a need for this.

brphelps commented 4 years ago

Alright, thanks for following up! Between this and the other issue I wrote up, I think our usage can get cleaned up if at least one goes in. If you're not a fan of the proposed change I think you should totally feel comfortable closing the issue

adamreeve commented 4 years ago

Ok thanks, yeah I think the namespace fix makes sense but am not so keen on this idea so will close this issue.