[Issue 3075] void delegate(const(void)[]) should be implicitly convertable to void delegate(void[])

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 10 06:15:15 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3075





--- Comment #17 from Steven Schveighoffer <schveiguy at yahoo.com>  2009-07-10 06:15:14 PDT ---
(In reply to comment #14)
> Strange. I thought overloading and overriding work in different ways, e.g.
> foo(int) and foo(long) can be overloads, but not overrides.

That's exactly what Walter means.

He doesn't want to have to support this kind of contravariance:

class X {}
class Y : X {}

class C
{
  void foo(Y y) {}
}

class D : C
{
  override void foo(X x) {}
}

Should be technically valid, since calling the base function still works on the
derived version (A Y is always an X).  I think personally, this kind of
contravariance provides little benefit, but being able to implicitly cast
delegates (or function pointers) is much more useful because you use them as
variables, which typically enjoy implicit conversion when passing as
parameters.

I don't share his opinion that doing this only for delegates is a hack.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list