digitalmars.D - static and non-static methods with same name
- Kris (7/7) Apr 08 2005 class Foo
- Sean Kelly (3/10) Apr 09 2005 FWIW, I can't reproduce this with DMD .120.
- Kris (6/19) Apr 09 2005 Thanks, Sean. Was this one fixed in v119? I see something similar noted
- Stewart Gordon (9/22) Apr 12 2005 The fix of this bug _was_ documented in the changelog. But it's vanishe...
- Walter (16/23) Apr 09 2005 The following compiles and runs fine:
class Foo { void init (int x) {} static void init (long y) {} } Given the above, an attempt to call either one causes a compile error; changing one of the method names resolves the conflict.
Apr 08 2005
In article <d37pf8$17b3$2 digitaldaemon.com>, Kris says...class Foo { void init (int x) {} static void init (long y) {} } Given the above, an attempt to call either one causes a compile error; changing one of the method names resolves the conflict.FWIW, I can't reproduce this with DMD .120. Sean
Apr 09 2005
Thanks, Sean. Was this one fixed in v119? I see something similar noted there. (couldn't use that version, given the "base class forward reference" issue, and couldn't download v120) "Sean Kelly" <sean f4.ca> wrote in message news:d392i3$164f$1 digitaldaemon.com...In article <d37pf8$17b3$2 digitaldaemon.com>, Kris says...class Foo { void init (int x) {} static void init (long y) {} } Given the above, an attempt to call either one causes a compile error; changing one of the method names resolves the conflict.FWIW, I can't reproduce this with DMD .120. Sean
Apr 09 2005
Sean Kelly wrote:In article <d37pf8$17b3$2 digitaldaemon.com>, Kris says...The fix of this bug _was_ documented in the changelog. But it's vanished. And using "init" as a member name is silly - it eclipses the built-in .init property, screwing up generic programming. I don't know why Walter didn't make this illegal. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.class Foo { void init (int x) {} static void init (long y) {} } Given the above, an attempt to call either one causes a compile error; changing one of the method names resolves the conflict.FWIW, I can't reproduce this with DMD .120.
Apr 12 2005
"Kris" <fu bar.com> wrote in message news:d37pf8$17b3$2 digitaldaemon.com...class Foo { void init (int x) {} static void init (long y) {} } Given the above, an attempt to call either one causes a compile error; changing one of the method names resolves the conflict.The following compiles and runs fine: class Foo { int init (int x) { return 1; } static int init (long y) { return 2; } } void main() { Foo f = new Foo(); int i; i = f.init(1); assert(i == 1); i = f.init(1L); assert(i == 2); }
Apr 09 2005
Thanks; the issue was resolved via the fixes in v119 (which couldn't be used due to that "base-class forward-ref" bug). "Walter" <newshound digitalmars.com> wrote in message news:d399dv$1jp6$1 digitaldaemon.com..."Kris" <fu bar.com> wrote in messagenews:d37pf8$17b3$2 digitaldaemon.com...class Foo { void init (int x) {} static void init (long y) {} } Given the above, an attempt to call either one causes a compile error; changing one of the method names resolves the conflict.The following compiles and runs fine: class Foo { int init (int x) { return 1; } static int init (long y) { return 2; } } void main() { Foo f = new Foo(); int i; i = f.init(1); assert(i == 1); i = f.init(1L); assert(i == 2); }
Apr 09 2005
I get this with 0.123: test.d(13): 'this' is required, but test.Foo is not a base class of Bar test.d(13): class test.Bar member hash is not accessible Both of which don't make sense to me.. module test; public class Foo { public int hash() {} public static int hash(double val) {} } public class Bar { public int hash() { return Foo.hash(1); } } xs0 PS: it happens if there is code in funcs, too Walter wrote:"Kris" <fu bar.com> wrote in message news:d37pf8$17b3$2 digitaldaemon.com...class Foo { void init (int x) {} static void init (long y) {} } Given the above, an attempt to call either one causes a compile error; changing one of the method names resolves the conflict.The following compiles and runs fine: class Foo { int init (int x) { return 1; } static int init (long y) { return 2; } } void main() { Foo f = new Foo(); int i; i = f.init(1); assert(i == 1); i = f.init(1L); assert(i == 2); }
May 12 2005