Thread overview
[dmd-internals] deprecated("message")
Jul 06, 2010
Michel Fortin
Jul 07, 2010
Leandro Lucarella
Jul 07, 2010
Ellery Newcomer
Jul 08, 2010
Ellery Newcomer
Jul 07, 2010
Sean Kelly
July 06, 2010
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 { ... }


Andrei
July 06, 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/



July 06, 2010
Andrei Alexandrescu wrote:
> So I'm proposing this:
>
> deprecated("You may want to use StaticMap")
> template staticMap { ... }

vote++ // it would be interesting to see what kind of computed message people come up with
July 06, 2010

Andrei Alexandrescu, el  6 de julio a las 17:58 me escribiste:
> 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 { ... }

This is not DMD-specific (or are you really proposing it as a DMD-only extension?), so I guess it should be in the general group.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
I would love to fix this world but I'm so lazy...
so lazy...

July 06, 2010
I was hoping to figure out whether Walter or Don would be interested in implementing this prior to posting on the newsgroup.

Andrei

On 07/06/2010 07:59 PM, Leandro Lucarella wrote:
>
>
> Andrei Alexandrescu, el  6 de julio a las 17:58 me escribiste:
>> 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 { ... }
>
> This is not DMD-specific (or are you really proposing it as a DMD-only extension?), so I guess it should be in the general group.
>
July 06, 2010
Funny, I was thinking the exact same thing today. Vote++

Sent from my iPhone

On Jul 6, 2010, at 3:58 PM, Andrei Alexandrescu <andrei at erdani.com> wrote:

> 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 { ... }
> 
> 
> Andrei
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
July 07, 2010
On 07/06/2010 09:45 PM, Andrei Alexandrescu wrote:
>
>
> I was hoping to figure out whether Walter or Don would be interested in implementing this prior to posting on the newsgroup.
>
> Andrei
>

maybe something like this?

http://personal.utulsa.edu/~ellery-newcomer/deprecated.diff

Not perfect, but it's a start.
July 08, 2010
If you've done the legwork, that's great (I'm not familiar with the dmd sources so I can't assess the diff). Walter?

Andrei

On 07/07/2010 09:14 AM, Ellery Newcomer wrote:
> On 07/06/2010 09:45 PM, Andrei Alexandrescu wrote:
>>
>>
>> I was hoping to figure out whether Walter or Don would be interested in implementing this prior to posting on the newsgroup.
>>
>> Andrei
>>
>
> maybe something like this?
>
> http://personal.utulsa.edu/~ellery-newcomer/deprecated.diff
>
> Not perfect, but it's a start.
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
July 08, 2010
On 07/08/2010 08:11 AM, Andrei Alexandrescu wrote:
> If you've done the legwork, that's great (I'm not familiar with the dmd sources so I can't assess the diff). Walter?
>
Neither am I, for the most part, plus I'm not very familiar with C++.

You might comment on behavior, though. Like weird stuff like

deprecated("yo mama"){
   class X;

   deprecated("she fat") class Y;
}

I don't know what a programmer would expect out of this. ATM, a use of X would trigger "yo mama", and a use of Y would trigger "yo mama, she fat".

And should this junk be printed to stdout or stderr?