std.math conflicts with std.mathspecial
Don Clugston
dac at nospam.com
Wed Jan 18 00:50:41 PST 2012
On 18/01/12 05:34, Jonathan M Davis wrote:
> On Wednesday, January 18, 2012 02:14:41 F i L wrote:
>> Also, you can do:
>>
>> import std.math;
>> import special = std.mathspecial;
>>
>> void main()
>> {
>> writeln(special.erf(0.5));
>> }
>>
>> See http://www.d-programming-language.org/module.html for more
>> information.
>
> I believe that his argument is that when there is a conflict and one of the two
> functions is deprecated (and you're not compiling with -d), then the
> deprecated function shouldn't be considered as part of the overload set. I'm
> not sure whether this is a good idea or not.
>
> With the current situation, you're forced to qualify the non-deprecated
> function, and your code will continue working after that (even after the
> deprecated function has been removed), but you'll be stuck with unnecessarily
> qualified function calls in the longe run.
>
> On the other hand, if we were to switch to what the OP suggests, then different
> if a function were deprecated and another matching function were added at the
> same time, then your code would silently start calling the new function,
> possibly resulting in incorrect behavior.
>
> Regardless, since private functions are included in overload resolution (see
> http://d.puremagic.com/issues/show_bug.cgi?id=1441 and more discussion of it
> in http://d.puremagic.com/issues/show_bug.cgi?id=6180 ), I wouldn't expect
> deprecated functions to be removed from overload resolution.
I'm not sure that that's the same. It's interesting to compare these two:
deprecated {
void foo1() {}
}
version(deprecated)
{
void foo2() {}
}
If compiled with -d, both foo1() and foo2() are identical.
If not compiled with -d, foo2() doesn't even exist.
But foo1() generates an error message if you try to use it.
Really the question is, should foo1() generate an error message if you
*might* be trying to use it? Or only if you are *definitely* trying to
use it?
My opinion is that it should be almost the same as foo2(): the
declaration exists ONLY for the purpose of generating a "must use -d" if
you try to call it. It's purely a service to help people migrate their
code. It should have no effect on people who have already migrated their
code.
>
> On the bright side, the deprecated function won't be around in the long run,
> so it's a temporary issue.
>
> - Jonathan M Davis
More information about the Digitalmars-d
mailing list