
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 10/08/2015 09:55 AM, Ben Gamari wrote:
Michael Orlitzky
writes: (replying to no one in particular)
This problem isn't specific to Haskell. In every other language, you have projects that support major versions of toolkits, compilers, libraries and whatnot. And there's already a tool for it: git.
Instead of using #ifdef to handle four different compilers, keep a branch for each. Git is designed to make this easy, and it's usually trivial to merge changes from the master branch back into e.g. the ghc-7.8 branch. That way the code in your master branch stays clean. When you want to stop supporting an old GHC, delete that branch.
I don't find this option terribly appealing. As a maintainer I would far prefer maintaining a bit of CPP than a proliferation of branches, with all of the cherry-picking and potential code divergence that they bring.
It's really not that bad. You only need a separate branch when things are actually incompatible, so while you may support four versions of GHC, you might only need two branches. And the difference between the branches should be exactly what you have wrapped in an #ifdef right now: a) If you're modifying something in an #ifdef, then the change only goes in one branch, and you don't have to cherry-pick anything. b) If the change wouldn't fall within an #ifdef, then it affects code common to all your branches, and the merge will be trivial. It's annoying to have to do that for every change, so don't. Keep a pile of common changes in your master branch, and then rebase/merge the other branches right before you make a release. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0 iQJ8BAEBCgBmBQJWFruJXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxNEU5RDcyRDdCMUFGREVGQzBCNDFDMUY2 RjQ4RDNEQTA1QzJEQURCAAoJEG9I09oFwtrbPB0P/37UFFBHqgN/Pspr26bdK4Hp j5TdF5RqP8BeiBg/shJyc1xrq4uB2wQZfrExCwfXssJYz+/Cuiw77MSYkay/ks3s LemyT6wIAypmjDOKHwzXw9mWU7oS9iL3CSPvZB07HLB4JNHpzBC0hAx3ZuMucyg7 xWFWgmlR5i1k069OCs+dgkfXotyt0zGtt17pw8YbX3X29/SOy9Y4K3+L6kfV8pOW dN/3/DIDakBDfLLLJG/pc57xq5GnTd77sCLNHrheWkybB3leW9t00Zq4erjBDyWt O7eO1jjTHoTo/S1iDWYGiy6zPI1dI+jDowUDLrZfIeAURw81ymqbfQlujwqoLB4j kWnaBDpT5JDhKZ3ZMWOcPtCGlUGbXIYh986s22jXfRhvO0dFNwwhbQOQdQMEUN74 XCggw4APIAHnA7lfg2s33bVOJr/d8XumnOCHD+7IEWYc+25lDWr42Ens7LOVJzv1 COh3JKAPbbWFpwmU2yKdowomiZglNZj9QW27e7x33ZU0rLITS2CdV/zmY5TLqf4S v40jJcQMt2ZSCW0X8HBpHdGG6tQxUWcYZR8kpbxoaoQgwwqYa+vN0aXyMd5tG3Bp cHyTDfya+Kt6lVa23kvs2YPXjUAXvSnoSBL646gpYvRvrx6L+T7Dd9UUNFGNg+8k +Dw1hH2mSYJ852ZreY9e =qH2g -----END PGP SIGNATURE-----