digitalmars.D - Reimplementing interface
- Frank Benoit (keinfarbton) (10/10) Nov 26 2006 Bug http://d.puremagic.com/issues/show_bug.cgi?id=502
 - Stewart Gordon (21/36) Nov 26 2006 I agree. And I've disputed the excuse for labelling that bug as invalid...
 
Bug http://d.puremagic.com/issues/show_bug.cgi?id=502
points out: a class that reimplements an interface, needs also to
reimplement all methods from the interface.
Currently this means, it is really necessary to do
  int f( int i ){
    return super.f( i );
  }
I think an alias should do the job.
  alias SuperClass.f f;
comments?
 Nov 26 2006
Frank Benoit (keinfarbton) wrote:
 Bug http://d.puremagic.com/issues/show_bug.cgi?id=502
 points out: a class that reimplements an interface, needs also to
 reimplement all methods from the interface.
 
 Currently this means, it is really necessary to do
 
   int f( int i ){
     return super.f( i );
   }
 
 I think an alias should do the job.
 
   alias SuperClass.f f;
 
 comments?
I agree.  And I've disputed the excuse for labelling that bug as invalid 
on this basis.
I think the reason for requiring interfaces to be explicitly implemented 
in that very class is that, if you don't watch out, you may end up 
implementing the interface by an inherited method with very different 
semantics.  But if you declare it as an alias in the class that 
implements the interface, then you're showing that you have watched out. 
  And so this should be one way of implementing the interface.
I don't really know what practical uses there are for reimplementing the 
same interface in a derived class, but in any case the same argument for 
allowing this applies.
Stewart.
-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-  C++  a->--- UB  P+ L E  W++  N+++ o K-  w++  O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------
My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
 Nov 26 2006








 
 
 
 Stewart Gordon <smjg_1998 yahoo.com>