On 01-09-2011 21:29, Steven Schveighoffer wrote:
On Thu, 01 Sep 2011 15:18:58 -0400, Alex Rønne Petersen
<[email protected]> wrote:
On 01-09-2011 21:13, Steven Schveighoffer wrote:
Since you are allowed to call static member functions, s.opAssign(1) for
the static one succeeds, but some of us are pushing to make this
invalid. It makes things very confusing when you call static functions,
but it looks like you are calling non-static member functions.
So that's to say x = 5; with a static opAssign would actually just...
do nothing?
Well, it would do nothing to x, since x isn't passed to the function (it
could possibly affect some static member). Which is why I feel it's a
far more confusing feature than it is worth.
However, there are some legitimate reasons to have a static function be
callable using an instance, which have to do with generic programming.
I recently created an enhancement request on this:
http://d.puremagic.com/issues/show_bug.cgi?id=6579
-Steve
I agree, it is confusing. Many other languages get by just fine without
static calls on instances, so I'm sure D can too...
- Alex