Bug 2244 – implementing a function with an alias is impossible
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2008-07-24T13:26:00Z
Last change time
2014-03-01T00:36:13Z
Keywords
rejects-valid
Assigned to
nobody
Creator
elite01
Comments
Comment #0 by elite01 — 2008-07-24T13:26:26Z
Following source:
interface Intf {
public void doIt();
}
class Impl : Intf {
public void impl() { /*empty*/ }
public alias impl doIt;
}
void main() {
(new Impl()).doIt;
}
Gives an error when compiled:
main.d:5: class main.Impl interface function Intf.doIt isn't implemented
The same happens with an abstract superclass, while it works when Impl doesn't extends Intf.
While this is just a test case, I stumbled upon this trying to implement functions using a template, like:
public alias EventHandler!(`mouseMove`, int, int) mouseMove;
I changed the code back to use string mixins, but I'd love to see something like the above work.
Comment #1 by fawzi — 2010-04-14T07:49:12Z
duplicate of #2683, that has a better discussion (even if it is newer)
*** This issue has been marked as a duplicate of issue 2683 ***