Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
June 12, 2012 Ddoc inheritance | ||||
---|---|---|---|---|
| ||||
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 Re: Ddoc inheritance | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alex Rønne Petersen | 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 Re: Ddoc inheritance | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alex Rønne Petersen | 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 Re: Ddoc inheritance | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alex Rønne Petersen | 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 Re: Ddoc inheritance | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Manzana | 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 Re: Ddoc inheritance | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | 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 |
Copyright © 1999-2021 by the D Language Foundation