Thread overview
[phobos] std.string deprecations
Feb 11, 2012
Martin Nowak
Feb 11, 2012
Jonathan M Davis
Feb 11, 2012
Jonathan M Davis
Feb 11, 2012
Jonathan M Davis
Feb 11, 2012
Martin Nowak
Feb 11, 2012
Jonathan M Davis
February 11, 2012
deprecated alias newSymbol oldSymbol;

If we'd settle on using deprecated aliases we could avoid duplicated
definitions.
Even better we could teach the compiler to propose replacements for
deprecated aliases.

Besides std.string.whitespace has no deprecation at all.
February 11, 2012
On Saturday, February 11, 2012 11:14:29 Martin Nowak wrote:
> deprecated alias newSymbol oldSymbol;
> 
> If we'd settle on using deprecated aliases we could avoid duplicated
> definitions.
> Even better we could teach the compiler to propose replacements for
> deprecated aliases.

But deprecated doesn't work on aliases.

> Besides std.string.whitespace has no deprecation at all.

Hmm. I'd better fix that. I guess that I missed it.

- Jonathan M Davis
February 11, 2012
On Saturday, February 11, 2012 02:25:02 Jonathan M Davis wrote:
> On Saturday, February 11, 2012 11:14:29 Martin Nowak wrote:
> > deprecated alias newSymbol oldSymbol;
> > 
> > If we'd settle on using deprecated aliases we could avoid duplicated
> > definitions.
> > Even better we could teach the compiler to propose replacements for
> > deprecated aliases.
> 
> But deprecated doesn't work on aliases.

Oh wait. I guess that it does. Was that changed? I was sure that it didn't.

- Jonathan M Davis
February 11, 2012
On Saturday, February 11, 2012 11:14:29 Martin Nowak wrote:
> deprecated alias newSymbol oldSymbol;
> 
> If we'd settle on using deprecated aliases we could avoid duplicated
> definitions.
> Even better we could teach the compiler to propose replacements for
> deprecated aliases.

I made newline an alias, but most of them can't be. std.string uses static arrays for all of its string constants, whereas std.ascii uses dynamic arrays. And while most of the other deprecations in std.string involve function renaming, they're templated functions, so alias doesn't work.

> Besides std.string.whitespace has no deprecation at all.

Fixed.

- Jonathan M Davis
February 11, 2012
On Sat, 11 Feb 2012 11:59:36 +0100, Jonathan M Davis <jmdavisProg at gmx.com> wrote:

> On Saturday, February 11, 2012 11:14:29 Martin Nowak wrote:
>> deprecated alias newSymbol oldSymbol;
>>
>> If we'd settle on using deprecated aliases we could avoid duplicated
>> definitions.
>> Even better we could teach the compiler to propose replacements for
>> deprecated aliases.
>
> I made newline an alias, but most of them can't be. std.string uses
> static
> arrays for all of its string constants, whereas std.ascii uses dynamic
> arrays.
> And while most of the other deprecations in std.string involve function
> renaming, they're templated functions, so alias doesn't work.
>
>> Besides std.string.whitespace has no deprecation at all.
>
> Fixed.
>
> - Jonathan M Davis
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos

So adding special deprecation messages for aliases wouldn't get us very far because the cases of a simple move are rare?
February 11, 2012
On Saturday, February 11, 2012 12:10:47 Martin Nowak wrote:
> So adding special deprecation messages for aliases wouldn't get us very far because the cases of a simple move are rare?

Well, it would be nice, but I wouldn't expect it to be all that useful in general. Pretty much the only time that we've just renamed functions is to fix camelcasing, and we've done almost all of that. The few that we might change that I'm aware of (e.g. the functions in std.string which still aren't properly camelcased are those which use patterns, and there was some discussion of replacing them with versions which used std.regex instead) involve more than just fixing the casing. So, deprecated aliases aren't likely to be very common in Phobos.

Also, if/once deprecated is improved to take a message as has been previously discussed, there would be no need to special case aliases. You could just put the information in the deprecation message like you would with any other deprecation.

- Jonathan M Davis