www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Ddoc inheritance

reply =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <alex lycus.org> writes:
Hi,

Suppose I have:

abstract class A
{
     /// My very long and helpful documentation.
     void foo();
}

class B : A
{
     override void foo()
     {
     }
}

Is there any way I can instruct Ddoc to copy the documentation from 
A.foo to B.foo? Copying it over manually is a maintenance nightmare.

Would be neat if you could do something like ditto:

     /// inherit
     override void foo()
     {
     }

-- 
Alex Rønne Petersen
alex lycus.org
http://lycus.org
Jun 11 2012
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 6/12/12, Alex R=F8nne Petersen <alex lycus.org> wrote:
 Would be neat if you could do something like ditto:

      /// inherit
      override void foo()
      {
      }
Maybe we should have "// super ditto" :)
Jun 11 2012
prev sibling next sibling parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Tuesday, June 12, 2012 02:59:05 Alex Rønne Petersen wrote:
 Hi,
 
 Suppose I have:
 
 abstract class A
 {
 /// My very long and helpful documentation.
 void foo();
 }
 
 class B : A
 {
 override void foo()
 {
 }
 }
 
 Is there any way I can instruct Ddoc to copy the documentation from
 A.foo to B.foo? Copying it over manually is a maintenance nightmare.
 
 Would be neat if you could do something like ditto:
 
 /// inherit
 override void foo()
 {
 }
I don't think that anything like that exists, but I expect that it wouldn't be all that hard to add. The trick, of course, is knowing/learning those sections of the compiler well enough to make the changes. - Jonathan M Davis
Jun 11 2012
prev sibling parent reply Ary Manzana <ary esperanto.org.ar> writes:
On 6/12/12 8:59 , Alex Rønne Petersen wrote:
 Hi,

 Suppose I have:

 abstract class A
 {
 /// My very long and helpful documentation.
 void foo();
 }

 class B : A
 {
 override void foo()
 {
 }
 }

 Is there any way I can instruct Ddoc to copy the documentation from
 A.foo to B.foo? Copying it over manually is a maintenance nightmare.

 Would be neat if you could do something like ditto:

 /// inherit
 override void foo()
 {
 }
I believe no special comment is needed for this. If you override a method without commenting it it should retain the original comment. If you do comment it, it should take that new comment. A patch for this should be really easy to do. Maybe I'll do it after (and if) my previous patch gets accepted.
Jun 11 2012
parent reply Jacob Carlborg <doob me.com> writes:
On 2012-06-12 04:20, Ary Manzana wrote:

 I believe no special comment is needed for this. If you override a
 method without commenting it it should retain the original comment. If
 you do comment it, it should take that new comment.
Sounds like a good idea. I wonder though, if a special comment is needed if you don't want the overridden method to appear in the docs, for whatever reason.
 A patch for this should be really easy to do. Maybe I'll do it after
 (and if) my previous patch gets accepted.
-- /Jacob Carlborg
Jun 11 2012
parent =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <alex lycus.org> writes:
On 12-06-2012 08:29, Jacob Carlborg wrote:
 On 2012-06-12 04:20, Ary Manzana wrote:

 I believe no special comment is needed for this. If you override a
 method without commenting it it should retain the original comment. If
 you do comment it, it should take that new comment.
Sounds like a good idea. I wonder though, if a special comment is needed if you don't want the overridden method to appear in the docs, for whatever reason.
That sounds like a reasonable thing to have. Hmm, there's also the issue of a method that implements two equally-named methods in two separate interfaces...
 A patch for this should be really easy to do. Maybe I'll do it after
 (and if) my previous patch gets accepted.
-- Alex Rønne Petersen alex lycus.org http://lycus.org
Jun 11 2012