
#10970: Built in MIN_VERSION macro support -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1349, Wiki Page: | Phab:D1869 -------------------------------------+------------------------------------- Comment (by hvr): Replying to [comment:3 rwbarton]:
[...] I don't understand any more why it should be the case that we only create these macros for packages explicitly specified with `-package` or equivalent.
Well, if you `-hide-all-packages` and unmask a few packages via `-package`, then exposing macros for all other packages in the package database would be very unsound, as it would destroy modularity. You don't expect package versions outside the set of explicitly requested ones to have any effect on your code, just like you wouldn't expect modules not explicitly imported to bring entities into scope (sadly, instances violate this already, but we shouldn't add to this any more). Also, always defining macros even though the packages are not activated (i.e. enabled via `-package`) would also break code which uses `#ifdef MIN_VERSION_...` to query whether a package has been activated for a given compilation, and thus its modules are allowed to be `import`ed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10970#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler