Re: Conflict between function and template with the same name

2014-06-29 Thread Timon Gehr via Digitalmars-d-learn
On 06/29/2014 11:31 AM, Rene Zwanenburg wrote: On Sunday, 29 June 2014 at 08:52:36 UTC, Uranuz wrote: import std.stdio; string getByName(string name) { return "smth"; } template getByName(string name) { enum getByName = .getByName(name); } void main() { writeln(getByName!("name")

Re: Conflict between function and template with the same name

2014-06-29 Thread Rene Zwanenburg via Digitalmars-d-learn
On Sunday, 29 June 2014 at 08:52:36 UTC, Uranuz wrote: import std.stdio; string getByName(string name) { return "smth"; } template getByName(string name) { enum getByName = .getByName(name); } void main() { writeln(getByName!("name")); } Thanks a lot! Very interestin

Re: Conflict between function and template with the same name

2014-06-29 Thread Uranuz via Digitalmars-d-learn
import std.stdio; string getByName(string name) { return "smth"; } template getByName(string name) { enum getByName = .getByName(name); } void main() { writeln(getByName!("name")); } Thanks a lot! Very interesting. Do you see any reasoning why this happens?

Re: Conflict between function and template with the same name

2014-06-29 Thread Rene Zwanenburg via Digitalmars-d-learn
On Sunday, 29 June 2014 at 07:16:10 UTC, Uranuz wrote: Is there any reason why function and template conflict. They using different syntax to *call*. For template we have *!* but for function we don't have it. So why compiler is not able to see the difference? I suspect this is by design. The

Conflict between function and template with the same name

2014-06-29 Thread Uranuz via Digitalmars-d-learn
I have a question about this example code; import std.stdio; string getByName(string name) { return "smth"; } template getByName(string name) { enum //string getByName = getByName(name); } void main() { writeln(getByName!("name")); } This produces comp