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


Christian Kamm <kamm-removet...@incasoftware.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |kamm-removet...@incasoftwar
                   |                            |e.de
         Resolution|                            |FIXED


--- Comment #7 from Christian Kamm <kamm-removet...@incasoftware.de> 2010-07-24 
09:15:23 PDT ---
Yes, it looks like template this parameters cover this use case. You can even
express the contract of a clone function nicely:

class B {
  T clone(this T)() {
    return (cast(T)this).cloneImpl();
  }
  B cloneImpl() { return new B; }
}

class D {
  override D cloneImpl() { return new D; }
}

If the user forgets to provide cloneImpl or doesn't make it return the correct
type, the compiler will complain. At least as long as clone!(D) gets
instantiated somewhere.

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

Reply via email to