511 – Various problems in the documentation

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 511 - Various problems in the documentation
Summary: Various problems in the documentation
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P4 normal
Assignee: Walter Bright
URL:
Keywords: patch, spec
Depends on: 467 508 509 510 512 515 516 520 550 551 556 559 560 562 563 565 566 567 576 577 610 630 631 632 633
Blocks:
Show dependency tree / graph
Reported: 2006年11月15日 05:30 UTC by Matti Niemenmaa
Modified: 2014年02月15日 13:28 UTC (History)
1 user (show)

See Also:
matti.niemenmaa+dbugzilla: d1.0blocker?


Attachments
Listing for http://www.digitalmars.com/d/abi.html (198 bytes, text/plain)
2006年11月15日 07:59 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/arrays.html (2.13 KB, text/plain)
2006年11月15日 08:00 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/attribute.html (158 bytes, text/plain)
2006年11月15日 08:00 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/class.html (1.79 KB, text/plain)
2006年11月15日 08:00 UTC, Matti Niemenmaa
Details
Patch for word count at http://www.digitalmars.com/d/arrays.html (3.13 KB, patch)
2006年11月15日 08:02 UTC, Matti Niemenmaa
Details | Diff
Corrected patch for word count at http://www.digitalmars.com/d/arrays.html (3.15 KB, patch)
2006年11月18日 05:49 UTC, Matti Niemenmaa
Details | Diff
Listing for http://www.digitalmars.com/d/cppstrings.html (270 bytes, text/plain)
2006年11月18日 06:41 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/cpptod.html (866 bytes, text/plain)
2006年11月18日 06:41 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/ctod.html (2.83 KB, text/plain)
2006年11月18日 06:41 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/dbc.html (1.33 KB, text/plain)
2006年11月18日 06:42 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/dcompiler.html (419 bytes, text/plain)
2006年11月18日 06:42 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/ddoc.html (329 bytes, text/plain)
2006年11月18日 06:42 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/declaration.html (277 bytes, text/plain)
2006年11月18日 06:42 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/dlinks.html (1.76 KB, text/plain)
2006年11月18日 06:43 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/dll.html (98 bytes, text/plain)
2006年11月18日 06:43 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/enum.html (72 bytes, text/plain)
2006年11月18日 06:43 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/errors.html (425 bytes, text/plain)
2006年11月18日 06:44 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/exception-safe.html (808 bytes, text/plain)
2006年11月18日 06:44 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/expression.html (1.12 KB, text/plain)
2006年11月18日 07:08 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/faq.html (2.31 KB, text/plain)
2006年11月18日 07:37 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/float.html (831 bytes, text/plain)
2006年11月18日 09:11 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/function.html (2.31 KB, text/plain)
2006年11月18日 10:07 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/future.html (490 bytes, text/plain)
2006年11月18日 10:12 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/garbage.html (81 bytes, text/plain)
2006年11月18日 10:16 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/htomodule.html (304 bytes, text/plain)
2006年11月18日 10:30 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/interfaceToC.html (273 bytes, text/plain)
2006年11月18日 10:45 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/memory.html (154 bytes, text/plain)
2006年11月18日 13:20 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/operatoroverloading.html (475 bytes, text/plain)
2006年11月18日 13:20 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/statement.html (904 bytes, text/plain)
2006年11月18日 13:20 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/template.html (734 bytes, text/plain)
2006年11月18日 13:21 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/templates-revisited.html (270 bytes, text/plain)
2006年11月18日 13:21 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/type.html (76 bytes, text/plain)
2006年11月18日 13:21 UTC, Matti Niemenmaa
Details
Listing for http://www.digitalmars.com/d/warnings.html (144 bytes, text/plain)
2006年11月18日 13:24 UTC, Matti Niemenmaa
Details
Show Obsolete (1) Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Matti Niemenmaa 2006年11月15日 05:30:13 UTC
With the upcoming release of D 1.0, I decided to take it upon myself to go through the documentation and note any inconsistencies, typos, errors, etc.
I'll be posting a plaintext attachment for each page of the documentation as soon as I'm done with one, listing problems and possible solutions.
Where there's a complete contradiction with compiler behaviour and the spec, it'll be separately filed in the Bugzilla. This bug is marked as depending on those bugs.
I won't go through the formal parts of the spec (LinkageAttribute, ScopeStatement... *head explodes*) and I'll try to avoid skimming too much, instead attempting to actually read every sentence in order to ensure I catch every single typo.
Large missing sections aren't mentioned here: this is only for lots of small corrections. For instance, the fact that functions taking arrays can be called as properties of arrays is (still) not mentioned anywhere in the spec, but it won't be listed below. If the feature were used in an example but not explained, then it would be listed. This is essentially just because I can't remember every single feature of D and I'm just woefully unfamiliar with others (mostly template-related stuff), so I don't notice that something is missing, whereas it's easy to see that something is mentioned only partially or incorrectly.
All nontrivial example code will be tested in the latest version of DMD (0.174 at time of writing, and hopefully also at time of completion), and corrections will be noted to all of that, as well, below.
With thanks to the Doc Comments at the Wiki4D: http://www.prowiki.org/wiki4d/wiki.cgi?DocComments - after processing a page myself I'll check for anything I've missed there, and it's already proved helpful, though I've only completed two pages so far.
- Matti "Deewiant" Niemenmaa, 2006年11月15日
--
Format:
PROBLEMs are actual problems, e.g. non-compiling or incorrect example code, or blatantly incorrect or outdated information in the text or comments.
MISSINGs are situations where something that should be mentioned for clarification is not, leading to unclear documentation.
NITPICKs are minor, e.g. spelling mistakes in non-code sections or code comments I see as confusing.
Suggested SOLUTIONs provided where it isn't completely obvious from the problem description.
Comment 1 Matti Niemenmaa 2006年11月15日 05:43:28 UTC
Well, it seems that attaching doesn't work at this time - Bugzilla throws internal errors in my face. I've emailed Brad about the issue. Until it's fixed, this bug is unfortunately fairly useless, but after that, I'll add the "patch" keyword and attach a bunch of files.
Comment 2 Matti Niemenmaa 2006年11月15日 07:59:14 UTC
Created attachment 44 [details] 
Listing for http://www.digitalmars.com/d/abi.html 
Comment 3 Matti Niemenmaa 2006年11月15日 08:00:08 UTC
Created attachment 45 [details] 
Listing for http://www.digitalmars.com/d/arrays.html 
Comment 4 Matti Niemenmaa 2006年11月15日 08:00:30 UTC
Created attachment 46 [details] 
Listing for http://www.digitalmars.com/d/attribute.html 
Comment 5 Matti Niemenmaa 2006年11月15日 08:00:53 UTC
Created attachment 47 [details] 
Listing for http://www.digitalmars.com/d/class.html 
Comment 6 Matti Niemenmaa 2006年11月15日 08:02:28 UTC
Created attachment 49 [details] 
Patch for word count at http://www.digitalmars.com/d/arrays.html
This is all for now. I'll be back with more on the weekend.
Comment 7 Stewart Gordon 2006年11月16日 19:23:39 UTC
*** Bug 181 has been marked as a duplicate of this bug. ***
Comment 8 Matti Niemenmaa 2006年11月18日 05:49:03 UTC
Created attachment 51 [details] 
Corrected patch for word count at http://www.digitalmars.com/d/arrays.html
Made a major screwup in the original patch, corrected that now.
I realised this when I found the original version of the code at www.digitalmars.com/d/cppstrings.html.
Updated wc.patch attached. It applies to the original code at www.digitalmars.com/d/arrays.html, not the version created after applying the previous patch.
Changes in addition to those in the original:
	- foreach loop has an added "j" index, keeping the original "j"s as "j"s instead of turning them into "i"s
	- the output loop at the end of the program uses the sorted keys array to match the version at cppstrings.html
Comment 9 Matti Niemenmaa 2006年11月18日 06:41:11 UTC
Created attachment 52 [details] 
Listing for http://www.digitalmars.com/d/cppstrings.html 
Comment 10 Matti Niemenmaa 2006年11月18日 06:41:38 UTC
Created attachment 53 [details] 
Listing for http://www.digitalmars.com/d/cpptod.html 
Comment 11 Matti Niemenmaa 2006年11月18日 06:41:55 UTC
Created attachment 54 [details] 
Listing for http://www.digitalmars.com/d/ctod.html 
Comment 12 Matti Niemenmaa 2006年11月18日 06:42:08 UTC
Created attachment 55 [details] 
Listing for http://www.digitalmars.com/d/dbc.html 
Comment 13 Matti Niemenmaa 2006年11月18日 06:42:20 UTC
Created attachment 56 [details] 
Listing for http://www.digitalmars.com/d/dcompiler.html 
Comment 14 Matti Niemenmaa 2006年11月18日 06:42:34 UTC
Created attachment 57 [details] 
Listing for http://www.digitalmars.com/d/ddoc.html 
Comment 15 Matti Niemenmaa 2006年11月18日 06:42:50 UTC
Created attachment 58 [details] 
Listing for http://www.digitalmars.com/d/declaration.html 
Comment 16 Matti Niemenmaa 2006年11月18日 06:43:03 UTC
Created attachment 59 [details] 
Listing for http://www.digitalmars.com/d/dlinks.html 
Comment 17 Matti Niemenmaa 2006年11月18日 06:43:17 UTC
Created attachment 60 [details] 
Listing for http://www.digitalmars.com/d/dll.html 
Comment 18 Matti Niemenmaa 2006年11月18日 06:43:31 UTC
Created attachment 61 [details] 
Listing for http://www.digitalmars.com/d/enum.html 
Comment 19 Matti Niemenmaa 2006年11月18日 06:44:19 UTC
Created attachment 62 [details] 
Listing for http://www.digitalmars.com/d/errors.html 
Comment 20 Matti Niemenmaa 2006年11月18日 06:44:34 UTC
Created attachment 63 [details] 
Listing for http://www.digitalmars.com/d/exception-safe.html 
Comment 21 Stewart Gordon 2006年11月18日 07:04:23 UTC
(In reply to comment #11)
> Created an attachment (id=54) [edit]
> Listing for www.digitalmars.com/d/ctod.html
`PROBLEM:
	Under "Formatted printing", the D code uses "import stdio;" which hasn't
	compiled for a very long time: use "import std.stdio".`
I don't think "import stdio;" has ever worked. The std package was established long before std.stdio was invented.
Moreover, it should be pointed out that printf shouldn't be mentioned at all under "The D way". To repeat the C way before giving the real D solution is inconsistent with the format of the rest of the page and the other conversion pages.
Comment 22 Matti Niemenmaa 2006年11月18日 07:08:29 UTC
Created attachment 64 [details] 
Listing for http://www.digitalmars.com/d/expression.html 
Comment 23 Stewart Gordon 2006年11月18日 07:09:52 UTC
(In reply to comment #12)
> Created an attachment (id=55) [edit]
> Listing for www.digitalmars.com/d/dbc.html
"SOLUTION:
	Replace long with float, double, or real, or use casts."
Using casts won't help the out contract to succeed. However, what will help is to change it to
 out (result)
 {
 assert(result * result <= x);
 assert((result + 1) * (result + 1) > x);
 }
Comment 24 Stewart Gordon 2006年11月18日 07:12:04 UTC
The http:// has disappeared from your attachment descriptions. It is nice to be able to get to the pages of the spec straight from the comments here.
Comment 25 Matti Niemenmaa 2006年11月18日 07:15:53 UTC
(In reply to comment #23)
> Using casts won't help the out contract to succeed.
You're right, my mistake: of course casting the result to a floating point type won't magically bring back what was lost in truncating to a long.(In reply to comment #24)
(In reply to comment #24)
> The http:// has disappeared from your attachment descriptions. It is nice to
> be able to get to the pages of the spec straight from the comments here.
> 
Fixed. That _was_ why I originally had it there, I just forgot about it today.
Comment 26 Matti Niemenmaa 2006年11月18日 07:37:37 UTC
Created attachment 65 [details] 
Listing for http://www.digitalmars.com/d/faq.html 
Comment 27 Matti Niemenmaa 2006年11月18日 09:11:32 UTC
Created attachment 66 [details] 
Listing for http://www.digitalmars.com/d/float.html 
Comment 28 Matti Niemenmaa 2006年11月18日 10:07:56 UTC
Created attachment 67 [details] 
Listing for http://www.digitalmars.com/d/function.html 
Comment 29 Matti Niemenmaa 2006年11月18日 10:12:50 UTC
Created attachment 68 [details] 
Listing for http://www.digitalmars.com/d/future.html 
Comment 30 Matti Niemenmaa 2006年11月18日 10:16:02 UTC
Created attachment 69 [details] 
Listing for http://www.digitalmars.com/d/garbage.html 
Comment 31 Matti Niemenmaa 2006年11月18日 10:30:38 UTC
Created attachment 70 [details] 
Listing for http://www.digitalmars.com/d/htomodule.html 
Comment 32 Matti Niemenmaa 2006年11月18日 10:45:52 UTC
Created attachment 71 [details] 
Listing for http://www.digitalmars.com/d/interfaceToC.html
I skipped http://www.digitalmars.com/d/iasm.html since I don't know enough Assembly language to have any kind of reasonable opinion on the contents.
Comment 33 Matti Niemenmaa 2006年11月18日 13:19:49 UTC
(In reply to comment #18)
> Created an attachment (id=61) [edit]
> Listing for www.digitalmars.com/d/enum.html
> 
Having come across property.html, I think it would be best to just link to that and say that enums are integral types. That, or add .sizeof, .alignof, and .mangleof to the list as well.
Comment 34 Matti Niemenmaa 2006年11月18日 13:20:18 UTC
Created attachment 72 [details] 
Listing for http://www.digitalmars.com/d/memory.html 
Comment 35 Matti Niemenmaa 2006年11月18日 13:20:37 UTC
Created attachment 73 [details] 
Listing for http://www.digitalmars.com/d/operatoroverloading.html 
Comment 36 Matti Niemenmaa 2006年11月18日 13:20:54 UTC
Created attachment 74 [details] 
Listing for http://www.digitalmars.com/d/statement.html 
Comment 37 Matti Niemenmaa 2006年11月18日 13:21:19 UTC
Created attachment 75 [details] 
Listing for http://www.digitalmars.com/d/template.html 
Comment 38 Matti Niemenmaa 2006年11月18日 13:21:43 UTC
Created attachment 76 [details] 
Listing for http://www.digitalmars.com/d/templates-revisited.html 
Comment 39 Matti Niemenmaa 2006年11月18日 13:21:59 UTC
Created attachment 77 [details] 
Listing for http://www.digitalmars.com/d/type.html 
Comment 40 Matti Niemenmaa 2006年11月18日 13:24:04 UTC
Created attachment 78 [details] 
Listing for http://www.digitalmars.com/d/warnings.html
Phew! That's all folks.
I won't be going through the Phobos documentation, at least right now: it's quite a bit more work since there are quite a bit more holes. To go through it in any reasonable way would practically require writing a large part of it again.
Comment 41 Matti Niemenmaa 2006年12月03日 05:16:34 UTC
Most changes folded in for DMD 0.176. The following issues, mostly of type NITPICK, remain (note that I didn't go through the pages thoroughly again, I just checked the changes I had already marked and their immediate vicinity):
http://www.digitalmars.com/d/class.html
	Under "Constructors", there is a code snippet "this() { if (a) ? this(1) : super(); }	// ok" which is syntactically invalid. Remove the "if".
http://www.digitalmars.com/d/ctod.html
	Under "Struct Initializations", there's an incorrect apostrophe in "{}'s".
	Under "Declaring struct types and variables", there's an excessive ampersand in the last sentence.
http://www.digitalmars.com/d/dbc.html
	Under "In, Out and Inheritance" only one of the "satisified" typos was corrected to "satisfied".
http://www.digitalmars.com/d/expression.html
	The last code block under "IsExpression" refers to x in a comment, while it should say v.
http://www.digitalmars.com/d/faq.html
	Under "Why are floating point values default initialized to NaN rather than 0?" the word "NaN's", with an incorrect apostrophe, is used instead of "NaNs".
http://www.digitalmars.com/d/operatoroverloading.html
	Under "Overloading == and !=" it is stated that that "if (a == null)" is converted to "if (a.opCmp(null)) which will fail if opCmp() is a virtual function". It should say opEquals instead of opCmp.
http://www.digitalmars.com/d/templates-revisited.html
	Under "SFINAE - Substitution Failure Is Not An Error" the last code snippet asserts when run: to fix it, change "typedef" to "alias", matching the change made to http://www.digitalmars.com/d/cpptod.html.
Comment 42 Bruno Medeiros 2006年12月09日 07:07:42 UTC
A Problem in http://www.digitalmars.com/d/function.html ,
in Lazy Variadic Functions, the following code segment is wrong:
 int delegate[] dg;
 foo(1, 3+x, dg, cast(int delegate[])null);
Should be:
 int delegate() dg;
 foo(1, 3+x, dg, cast(int delegate())null);
Comment 43 Walter Bright 2006年12月09日 21:09:55 UTC
Fixed DMD 0.177


AltStyle によって変換されたページ (->オリジナル) /