Ticket #3665 (closed feature request: fixed)

Opened 4 years ago

Last modified 4 years ago

Add whole-package deprecation warnings

Reported by: duncan Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.12.1 RC1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

With GHC-6.12 if you use base 3 you get:

    Warning: Module `Prelude' is deprecated:
                 [You are using an old version of base. Future
GHC versions will not support this version, so you need to
update your code to use the new base version.]

This is initially a somewhat confusing warning. We're not really deprecating the Prelude!

It would be much nicer if it told us:

    Warning: Package `base-3.0.3.2' is deprecated:
                 [You are using an old version of base. Future
GHC versions will not support this version, so you need to
update your code to use the new base version.]

The message itself could be formatted more nicely too. Patch attached for that.

Note the current spurious list syntax in the deprecation message. I've re-opened #3303 about that.

As for the syntax for package deprecations, how about just

module Foo {-# DEPRECATED package "the message" #-} (..) where

For the behaviour, how about making them behave just like module-deprecation messages in that one attaches them to a module header and they are only triggered if you import that module. The only change would be in how the message is reported; instead of saying the module is deprecated it'd give the package (including the full version).

I know this is a feature request, which usually we'd want to put off for the next major version, but since this one is all about helping maintainers and users of 6.12.1 and .2, I hope that we consider looking at it for an early 6.12 release.

Attachments

base3-deprecation-message.dpatch Download (1.5 KB) - added by duncan 4 years ago.

Change History

Changed 4 years ago by duncan

Changed 4 years ago by simonpj

  • difficulty set to Unknown

Is the module itself the right place for such a message? After all, if you deprecate a package you probably deprecate all the exposed modules in the package, so it's a bit tedious to have to do that module by module. Moreover, the identical code might appear in an updated version of the package, so it's not really that code that's deprecated; it's the context in which it appears.

Isn't the .cabal file the right place to deprecate a package? After all, that's where all its metadata is given. And Cabal itself might like to know about deprecations during its ruminations, not just GHC.

So I'm unconvinced.

Simon

Changed 4 years ago by igloo

  • status changed from new to closed
  • failure set to None/Unknown
  • resolution set to fixed

I've applied the base3-deprecation-message in 6.12 (HEAD doesn't have base3-compat), and I agree that package-wide deprecation is really a Cabal or cabal-install feature request, not something we should do in GHC.

Note: See TracTickets for help on using tickets.