dub
dub copied to clipboard
Use a typed PackageRecipe for packagesuppliers
Instead of dealing with raw json, it is better to parse it at first sight.
Yes! I've been wanting this for a while, but the problem is that it's a breaking change for library users.
Instead adding a final function that forwards to the implementation might do the trick ?
but the problem is that it's a breaking change for library users.
Ah, you mean people who inherit from AbstractFallbackPackageSupplier.
Hmm yes, likely not many, but still.
Ah, you mean people who inherit from
AbstractFallbackPackageSupplier.Hmm yes, likely not many, but still.
Actually, changing the return type of fetchPackageRecipe means anyone implementing the PackageSupplier interface.
Still, likely not many, but there aren't many users of Dub as a library. Adding a final function that does the job would help in the short term, and we can just rework this interface in a future major version.
@skoppe : If you can find a small change to make (e.g. the [] => null changes) and PR it separately, that would whitelist you for future CI runs of Github, otherwise you'll need someone to keep on approving it every time you update this PR.
@Geod24 I don't quite understand how final is going to help, maybe I am missing something.
The way I see it is that I can't just change the PackageSupplier interface, since it is public, and people might have inherited from it.
This means we need to keep the Json fetchPackageRecipe(string packageId, Dependency dep, bool pre_release) function for a while, and deprecate it.
Additionally I can't just add a Nullable!PackageRecipe fetchPackageRecipe(string packageId, Dependency dep, bool pre_release) function, without providing a base implementation. Not to mention that its name conflicts with the deprecated one.
I think I need to add a fetchRecipe function with a base implementation that just calls the original fetchPackageRecipe, while deprecating the latter.
Using that I can implement both fetchRecipe and fetchPackageRecipe in the current package suppliers.
I think I need to add a [...]
Yes, that's what I was recommending. final because "function body only allowed in final functions in interface".