Re: Static method conflicts with non-static method?

2012-04-28 Thread Christophe
"Steven Schveighoffer" , dans le message (digitalmars.D:165141), a > The idea I came up with in my proposal > (http://d.puremagic.com/issues/show_bug.cgi?id=6579) was to allow aliasing > the static method into the instance namespace: +1

Re: Static method conflicts with non-static method?

2012-04-27 Thread Jacob Carlborg
On 2012-04-27 07:07, H. S. Teoh wrote: Is this a bug? Code: import std.stdio; struct S { static int func(int x) { return x+1; } int func(int x) { return x+2; } } void main() { S s; writeln(s.func(1)

Re: Static method conflicts with non-static method?

2012-04-27 Thread Steven Schveighoffer
On Fri, 27 Apr 2012 09:15:31 -0400, so wrote: On Friday, 27 April 2012 at 12:35:53 UTC, Steven Schveighoffer wrote: Huh? The main reason of confusion is that the static method is named in such a way that it looks like an instance method. So we prevent that, unless the author of the class

Re: Static method conflicts with non-static method?

2012-04-27 Thread so
On Friday, 27 April 2012 at 12:35:53 UTC, Steven Schveighoffer wrote: Huh? The main reason of confusion is that the static method is named in such a way that it looks like an instance method. So we prevent that, unless the author of the class (who is deciding the name of the function) deems

Re: Static method conflicts with non-static method?

2012-04-27 Thread Steven Schveighoffer
On Fri, 27 Apr 2012 08:11:48 -0400, so wrote: On Friday, 27 April 2012 at 11:51:40 UTC, Steven Schveighoffer wrote: The idea I came up with in my proposal (http://d.puremagic.com/issues/show_bug.cgi?id=6579) was to allow aliasing the static method into the instance namespace: struct S1 {

Re: Static method conflicts with non-static method?

2012-04-27 Thread so
On Friday, 27 April 2012 at 11:51:40 UTC, Steven Schveighoffer wrote: The idea I came up with in my proposal (http://d.puremagic.com/issues/show_bug.cgi?id=6579) was to allow aliasing the static method into the instance namespace: struct S1 { static void foo() {} alias S1.foo this.foo;

Re: Static method conflicts with non-static method?

2012-04-27 Thread so
On Friday, 27 April 2012 at 11:49:08 UTC, Kevin Cox wrote: On Apr 27, 2012 7:34 AM, "so" wrote: I agree it is ugly. If there is a way out (reason why i asked), we should just dump it. I don't like the idea either because it is confusing. The only reason I can imagine is if there was polym

Re: Static method conflicts with non-static method?

2012-04-27 Thread Steven Schveighoffer
On Fri, 27 Apr 2012 07:31:50 -0400, so wrote: On Friday, 27 April 2012 at 11:23:39 UTC, Steven Schveighoffer wrote: On Fri, 27 Apr 2012 07:03:02 -0400, so wrote: On Friday, 27 April 2012 at 10:48:29 UTC, Steven Schveighoffer wrote: With the advent of UFCS, this argument has much less teeth

Re: Static method conflicts with non-static method?

2012-04-27 Thread Kevin Cox
On Apr 27, 2012 7:34 AM, "so" wrote: > > I agree it is ugly. If there is a way out (reason why i asked), we should just dump it. I don't like the idea either because it is confusing. The only reason I can imagine is if there was polymorphism on statics which I see as a fairly useless feature.

Re: Static method conflicts with non-static method?

2012-04-27 Thread so
On Friday, 27 April 2012 at 11:23:39 UTC, Steven Schveighoffer wrote: On Fri, 27 Apr 2012 07:03:02 -0400, so wrote: On Friday, 27 April 2012 at 10:48:29 UTC, Steven Schveighoffer wrote: With the advent of UFCS, this argument has much less teeth. Maybe it should be revisited... -Steve E

Re: Static method conflicts with non-static method?

2012-04-27 Thread Steven Schveighoffer
On Fri, 27 Apr 2012 07:03:02 -0400, so wrote: On Friday, 27 April 2012 at 10:48:29 UTC, Steven Schveighoffer wrote: With the advent of UFCS, this argument has much less teeth. Maybe it should be revisited... -Steve Elaborate please how UFCS would help in that context. Hm... thinking a

Re: Static method conflicts with non-static method?

2012-04-27 Thread so
On Friday, 27 April 2012 at 10:48:29 UTC, Steven Schveighoffer wrote: With the advent of UFCS, this argument has much less teeth. Maybe it should be revisited... -Steve Elaborate please how UFCS would help in that context.

Re: Static method conflicts with non-static method?

2012-04-27 Thread Steven Schveighoffer
On Fri, 27 Apr 2012 01:07:03 -0400, H. S. Teoh wrote: Is this a bug? Code: import std.stdio; struct S { static int func(int x) { return x+1; } int func(int x) { return x+2; } } void main() { S s;

Re: Static method conflicts with non-static method?

2012-04-26 Thread Paulo Pinto
On Friday, 27 April 2012 at 06:14:13 UTC, H. S. Teoh wrote: Is this a bug? Code: import std.stdio; struct S { static int func(int x) { return x+1; } int func(int x) { return x+2; } } void main() { S s;

Static method conflicts with non-static method?

2012-04-26 Thread H. S. Teoh
Is this a bug? Code: import std.stdio; struct S { static int func(int x) { return x+1; } int func(int x) { return x+2; } } void main() { S s; writeln(s.func(1)); } DMD (latest git) output: