Overloading an imported function
    Shriramana Sharma via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Wed Oct 21 05:05:21 PDT 2015
    
    
  
import std.math;
real round(real val, int prec)
{
    real pow = 10 ^^ prec;
    return round(val * pow) / pow;
}
Trying to compile this I get:
foo.d(5): Error: function foo.round (real val, int prec) is not callable 
using argument types (real)
When I've imported std.math which contains round(real), why is the compiler 
complaining about not being able to call the overload function defined in 
*this* module?
I don't see anything in http://dlang.org/module.html that says I cannot 
define an overload of an imported function. Did I miss something?
-- 
Shriramana Sharma, Penguin #395953
    
    
More information about the Digitalmars-d-learn
mailing list