Thread overview
Ddoc inheritance
Jun 12, 2012
Andrej Mitrovic
Jun 12, 2012
Jonathan M Davis
Jun 12, 2012
Ary Manzana
Jun 12, 2012
Jacob Carlborg
June 12, 2012
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
June 12, 2012
On 6/12/12, Alex Rønne 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" :)
June 12, 2012
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
June 12, 2012
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.
June 12, 2012
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
June 12, 2012
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