digitalmars.D.learn - function XXXX conflict with YYYY
- Agustin (11/11) Nov 14 2013 final uint registerEvent(T, J)(IPlugin, void delegate(J))
- evilrat (4/16) Nov 14 2013 this is by design. templates are generic so they can take
- evilrat (2/2) Nov 14 2013 mmm.. this is strange because for simple types it works fine(i'm
- Gary Willoughby (2/5) Nov 14 2013 See bearophile's answer.
- bearophile (5/17) Nov 14 2013 Have you tried an updated DMD compiler? I think this was recently
- Gary Willoughby (21/33) Nov 14 2013 This works fine with v2.064.2
- H. S. Teoh (9/23) Nov 14 2013 On older compilers, you can work around this limitation by adding empty
- Gary Willoughby (2/3) Nov 14 2013 http://www.youtube.com/watch?v=d-S1o5OmMMo
- Agustin (3/3) Nov 14 2013 Thanks, i updated to v2.064.2 and everything works just fine. I
final uint registerEvent(T, J)(IPlugin, void delegate(J)) { .... } final uint registerEvent(IPlugin, EventHandler, EventInfo, ulong) { .... } There seems to be a problem when having two function with same name but different parameters. Only happend when one of the function use templates. Is that a compiler limitation?
Nov 14 2013
On Thursday, 14 November 2013 at 16:27:39 UTC, Agustin wrote:final uint registerEvent(T, J)(IPlugin, void delegate(J)) { .... } final uint registerEvent(IPlugin, EventHandler, EventInfo, ulong) { .... } There seems to be a problem when having two function with same name but different parameters. Only happend when one of the function use templates. Is that a compiler limitation?this is by design. templates are generic so they can take anything(by default), this way shadowing specialized functions which is more suitable for certain types.
Nov 14 2013
mmm.. this is strange because for simple types it works fine(i'm using dmd 2.064.2). can you show reduced example of this?
Nov 14 2013
On Thursday, 14 November 2013 at 16:59:25 UTC, evilrat wrote:mmm.. this is strange because for simple types it works fine(i'm using dmd 2.064.2). can you show reduced example of this?See bearophile's answer.
Nov 14 2013
Agustin:final uint registerEvent(T, J)(IPlugin, void delegate(J)) { .... } final uint registerEvent(IPlugin, EventHandler, EventInfo, ulong) { .... } There seems to be a problem when having two function with same name but different parameters. Only happend when one of the function use templates. Is that a compiler limitation?Have you tried an updated DMD compiler? I think this was recently fixed. Bye, bearophile
Nov 14 2013
On Thursday, 14 November 2013 at 16:27:39 UTC, Agustin wrote:final uint registerEvent(T, J)(IPlugin, void delegate(J)) { .... } final uint registerEvent(IPlugin, EventHandler, EventInfo, ulong) { .... } There seems to be a problem when having two function with same name but different parameters. Only happend when one of the function use templates. Is that a compiler limitation?This works fine with v2.064.2 import std.stdio; class ClassName { final uint registerEvent(T, J)(T x, void delegate(J)) { return 1; } final uint registerEvent(long, string, int, ulong) { return 1; } } void main(string[] args) { auto x = new ClassName(); writefln("%s", x.registerEvent!(int, int)(1, delegate(int x) {})); writefln("%s", x.registerEvent(1, "sdsds", 3, 4)); }
Nov 14 2013
On Thu, Nov 14, 2013 at 05:27:38PM +0100, Agustin wrote:final uint registerEvent(T, J)(IPlugin, void delegate(J)) { .... } final uint registerEvent(IPlugin, EventHandler, EventInfo, ulong) { .... } There seems to be a problem when having two function with same name but different parameters. Only happend when one of the function use templates. Is that a compiler limitation?On older compilers, you can work around this limitation by adding empty compile-time parameters to the second function: final uint registerEvent()(IPlugin, EventHandler, EventInfo, ulong) { ... }From what I heard, this limitation has been removed in the latestcompiler. T -- It only takes one twig to burn down a forest.
Nov 14 2013
On Thursday, 14 November 2013 at 17:13:18 UTC, H. S. Teoh wrote:It only takes one twig to burn down a forest.http://www.youtube.com/watch?v=d-S1o5OmMMo
Nov 14 2013
Thanks, i updated to v2.064.2 and everything works just fine. I had this issue long time ago and it was annoying to have multiple function with different names.
Nov 14 2013