Is this correct?

Jonathan Marler johnnymarler at gmail.com
Thu Feb 6 23:05:19 UTC 2020


The named arguments DIP got to question what this example would 
do:

--- foolib.d
import std.stdio;
void foo(string s) { writefln("foo string"); }


--- main.d
import std.stdio;
import foolib;
void foo(const(char)[] s) { writefln("foo const"); }
void main()
{
    foo("hello");
}


This prints "foo const".  And if you move the function overload 
from foolib.d to main.d, it will print "foo string".  Is this the 
expected behavior?



More information about the Digitalmars-d mailing list