June 24, 2013
On Sunday, 23 June 2013 at 10:09:39 UTC, Jonathan M Davis wrote:
>> Also I don't know why I should call static methods from an
>> instance. What's the purpose?
>
> It's stupid and pointless as far as I can tell, but I believe that C++, Java,
> C#, and D all do it, so as stupid as it is, it's a common stupidity

Java prevents it, I'm pretty sure C# picked that up from Java. (Unless Java has changed since 1.5)
June 24, 2013
On Monday, June 24, 2013 19:13:45 Jesse Phillips wrote:
> On Sunday, 23 June 2013 at 10:09:39 UTC, Jonathan M Davis wrote:
> >> Also I don't know why I should call static methods from an instance. What's the purpose?
> > 
> > It's stupid and pointless as far as I can tell, but I believe
> > that C++, Java,
> > C#, and D all do it, so as stupid as it is, it's a common
> > stupidity
> 
> Java prevents it, I'm pretty sure C# picked that up from Java.
> (Unless Java has changed since 1.5)

I was certain that I'd checked it at one point and determined that Java allowed it, but I could be wrong. It's certainly better if I am, since it's a bad design decision to allow static functions to be called on instances IMHO.

- Jonathan M Davis
June 24, 2013
On Monday, June 24, 2013 11:51:52 Steven Schveighoffer wrote:
> My suggestion to fix this has always been: only allow static calls on instance variables via opt-in. e.g.:
> 
> class InfiniteRange
> {
> static bool empty() { return false; }
> alias InfiniteRange.empty this.empty; // just an example
> }
> 
> This allows all the benefit, but none of the bug-prone problems.

I would _love_ to make that fix, but the trick is convincing Walter (since the chance risks breaking code). Or maybe it's one of those things that convincing Kenji to implement it would be enough, since it could sneak in that way? I don't know. Regardless, I think that we'd be better off if we made the change.

- Jonathan M Davis
1 2 3
Next ›   Last »