Bug 9676 – Ddoc: Wrap deprecated declarations in a $(DEPRECATED) macro

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-09T08:58:00Z
Last change time
2013-03-15T13:54:14Z
Keywords
pull
Assigned to
andrej.mitrovich
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-03-09T08:58:42Z
A low priority enhancement request. This D code: module test; /// deprecated void foo() {} void main() {} Compiled with doc generation (-D) gives the HTML: <html><head> <META http-equiv="content-type" content="text/html; charset=utf-8"> <title>test</title> </head><body> <h1>test</h1> <!-- Generated by Ddoc from temp.d --> <br><br> <dl><dt><big><a name="foo"></a>deprecated void <u>foo</u>(); </big></dt> <dd><br><br> </dd> </dl> <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> </body></html> I suggest to add <del>...</del> pairs around the name of deprecated functions: <dl><dt><big><a name="foo"></a>deprecated <del>void <u>myfunc</u>();</del>
Comment #1 by andrej.mitrovich — 2013-03-11T17:27:23Z
HTML hardcoding is unnecessary. Instead we should introduce a $(DEP) macro, which can expand to the supported export format.
Comment #2 by andrej.mitrovich — 2013-03-11T17:32:43Z
Comment #3 by bearophile_hugs — 2013-03-12T17:42:21Z
Andrej Mitrovic: >I thought bearophile just wanted the ability to highlight the function in some way to make it stand-out more.< I wanted dmd to add <del></del> around the function, to make it stand-oud less than other functions (to make it more visually clear they are deprecated). Walter: >Yes, it should wrap the whole thing. Then bearophile can add his own definition of DEP to highlight as he wishes with it.< This issue asks for <del></del> in the standard online documentation. I don't have personal uses for such a macro.
Comment #4 by bearophile_hugs — 2013-03-12T17:48:06Z
Walter: >the default expansion for deprecated symbols should be to nothing. Otherwise, people will continue to use them.< I think this isn't a good idea. If I am using a function in my code and it's deprecated this forces me to go read the source code. If you don't want a function to be visible in the documentation then replace its /**...*/ and /// with /*...*/ and //. In Scala deprecated names are clearly visible as deprecated, but they aren't invisible, I think this is the right default: http://twitter.github.com/algebird/com/twitter/algebird/BloomFilterMonoid.html
Comment #5 by andrej.mitrovich — 2013-03-12T17:49:58Z
(In reply to comment #3) > This issue asks for <del></del> in the standard online documentation. I don't > have personal uses for such a macro. Right, but you can't add <del></del> without knowing where to inject it to, hence why you need a macro first. Then for HTML generation $(DEPRECATED foo) will simply expand to <del>foo</del>. So essentially these are two feature requests, one depends on the other.
Comment #6 by andrej.mitrovich — 2013-03-12T17:51:28Z
(In reply to comment #5) > So essentially these are two feature requests, one depends on the other. Although perhaps I should have opened a separate issue instead of hijacking your ER. Sorry about that!
Comment #7 by bearophile_hugs — 2013-03-12T18:36:14Z
(In reply to comment #5) > Right, but you can't add <del></del> without knowing where to inject it to, > hence why you need a macro first. I am aware of this. (In reply to comment #6) > Although perhaps I should have opened a separate issue instead of hijacking > your ER. Sorry about that! Don't worry, small misunderstandings between persons are common. And I think the two issues are closely related.
Comment #8 by bugzilla — 2013-03-15T13:52:15Z
Comment #9 by github-bugzilla — 2013-03-15T13:52:58Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/3713141018e8c919288de10ab357333c5e93afc3 Fixes Issue 9676 - Deprecated declarations should be wrapped in $(DEPRECATED) macro. https://github.com/D-Programming-Language/dmd/commit/69717dc210a1adde1e2dd8026143b64aa8c85119 Merge pull request #1740 from AndrejMitrovic/Fix9676 Issue 9676 - Deprecated declarations should be wrapped in $(DEPRECATED) macro.