[dmd-internals] deprecated("message")

Michel Fortin michel.fortin at michelf.com
Tue Jul 6 16:29:16 PDT 2010


Le 2010-07-06 à 18:58, Andrei Alexandrescu a écrit :

> I think we need an optional message with deprecated. Most of the time something is deprecated in favor of an alternative artifact, and deprecated makes it impossible to point to that.
> 
> Because of that, I've been resorting to pragma(msg, "xxx") and static assert(false, "xxx") to provide guidance. Both leave a lot to be desired and have no integration with deprecated.
> 
> So I'm proposing this:
> 
> deprecated("You may want to use StaticMap")
> template staticMap { ... }

The current way to document this is to use Ddoc:

	/**
	 * Deprecated: You may want to use StaticMap.
	 */
	deprecated template staticMap();

This allows for a more detailed explanation than what you're proposing. Perhaps the compiler could just extract the first sentence of that "Deprecated" section of the documentation comment and print it along with the error message.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the dmd-internals mailing list