Am 12.01.2011 01:17, schrieb Jonathan M Davis:
On Tuesday, January 11, 2011 16:07:11 Daniel Gibson wrote:
Am 12.01.2011 00:59, schrieb Jonathan M Davis:
On Tuesday, January 11, 2011 15:29:54 Ary Borenszweig wrote:
So what's a good use for aliases?

2. Deprecating a function name. For instance, let's say that we rename
splitl to splitL or SplitLeft in std.string. Having a deprecated alias
to splitl would avoid immediately breaking code.

Isn't this exactly what Ary had in mind? :-)

No, or at least that's not the impression that I got. I understood that he meant
to have to aliases around permanently. It's just confusing and adds clutter to
do things like have both splitl and splitLeft (or splitL or whotever splitl got
renamed to) around in the long run. _That_ is what Andrei and Walter is
objecting to.

Renaming a function and having a deprecated alias to the old name for a few
releases eases the transition would definitely be good practice. aliasing a
function just to have another name for the same thing wouldn't be good practice.
There has to be a real benefit to having the second name. Providing a smooth
deprecation route would be a case where there's a real benefit.

- Jonathan M Davis

Ok, you're right, that is a slight difference.

Deprecating them is certainly a good idea, but I'd suggest to keep the deprecated aliases around for longer (until D3), so anybody porting a Phobos1-based application to D2/Phobos2 can use them, even if he doesn't do this within the next few releases.

Cheers,
- Daniel

Reply via email to