Changeset 2040
- Timestamp:
- 09/19/10 02:11:27 (2 years ago)
- Files:
-
- trunk/docsrc/abi.dd (modified) (2 diffs)
- trunk/docsrc/attribute.dd (modified) (2 diffs)
- trunk/docsrc/const.dd (modified) (1 diff)
- trunk/docsrc/cppcomplex.dd (modified) (2 diffs)
- trunk/docsrc/cppstrings.dd (modified) (3 diffs)
- trunk/docsrc/cpptod.dd (modified) (2 diffs)
- trunk/docsrc/d-floating-point.dd (modified) (4 diffs)
- trunk/docsrc/ddoc.dd (modified) (3 diffs)
- trunk/docsrc/declaration.dd (modified) (2 diffs)
- trunk/docsrc/dstyle.dd (modified) (6 diffs)
- trunk/docsrc/errors.dd (modified) (1 diff)
- trunk/docsrc/exception-safe.dd (modified) (3 diffs)
- trunk/docsrc/faq.dd (modified) (2 diffs)
- trunk/docsrc/features2.dd (modified) (1 diff)
- trunk/docsrc/garbage.dd (modified) (1 diff)
- trunk/docsrc/htomodule.dd (modified) (1 diff)
- trunk/docsrc/lex.dd (modified) (4 diffs)
- trunk/docsrc/lisp-java-d.dd (modified) (1 diff)
- trunk/docsrc/memory.dd (modified) (1 diff)
- trunk/docsrc/module.dd (modified) (2 diffs)
- trunk/docsrc/operatoroverloading.dd (modified) (1 diff)
- trunk/docsrc/overview.dd (modified) (1 diff)
- trunk/docsrc/pragma.dd (modified) (1 diff)
- trunk/docsrc/pretod.dd (modified) (1 diff)
- trunk/docsrc/property.dd (modified) (1 diff)
- trunk/docsrc/rationale.dd (modified) (3 diffs)
- trunk/docsrc/regular-expression.dd (modified) (1 diff)
- trunk/docsrc/safed.dd (modified) (1 diff)
- trunk/docsrc/statement.dd (modified) (2 diffs)
- trunk/docsrc/struct.dd (modified) (1 diff)
- trunk/docsrc/template-mixin.dd (modified) (2 diffs)
- trunk/docsrc/templates-revisited.dd (modified) (32 diffs)
- trunk/docsrc/traits.dd (modified) (1 diff)
- trunk/docsrc/tuple.dd (modified) (2 diffs)
- trunk/docsrc/warnings.dd (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/docsrc/abi.dd
r1416 r2040 703 703 On Linux, a real is pushed as a 12 byte quantity, 704 704 a creal is pushed as two 12 byte quantities. 705 The extra two bytes of pad occupy the 'most significant'position.705 The extra two bytes of pad occupy the $(SINGLEQUOTE most significant) position. 706 706 ) 707 707 … … 1046 1046 $(TD DW_TAG_delegate_type) 1047 1047 $(TD 0x43) 1048 $(TD DW_AT_type, is function type, DW_AT_containing_type is 'this'type)1048 $(TD DW_AT_type, is function type, DW_AT_containing_type is $(SINGLEQUOTE this) type) 1049 1049 ) 1050 1050 ) trunk/docsrc/attribute.dd
r1404 r2040 263 263 function, 264 264 that member can only be accessed for the object instance 265 which is the 'this'object for the member function call.265 which is the $(SINGLEQUOTE this) object for the member function call. 266 266 Protected module members are illegal. 267 267 ) … … 533 533 Functions declared as abstract can still have function 534 534 bodies. This is so that even though they must be overridden, 535 they can still provide 'base class functionality.'535 they can still provide $(SINGLEQUOTE base class functionality.) 536 536 ) 537 537 trunk/docsrc/const.dd
r747 r2040 355 355 But const cannot be implicitly converted to invariant, and neither can 356 356 mutable references. 357 Essentially, const is a weaker form of invariant because it says: "you can't358 change this data; someone else may or may not be able to change it. "357 Essentially, const is a weaker form of invariant because it says: $(DOUBLEQUOTE you can't 358 change this data; someone else may or may not be able to change it.) 359 359 ) 360 360 trunk/docsrc/cppcomplex.dd
r659 r2040 37 37 ) 38 38 39 In D, an imaginary numeric literal has the 'i'suffix.39 In D, an imaginary numeric literal has the $(SINGLEQUOTE i) suffix. 40 40 The corresponding code would be the more natural: 41 41 … … 187 187 <p> 188 188 189 "Branch Cuts for Complex Elementary Functions,190 or Much Ado About Nothing's Sign Bit "189 $(DOUBLEQUOTE Branch Cuts for Complex Elementary Functions, 190 or Much Ado About Nothing's Sign Bit) 191 191 by W. Kahan, ch.<br> 192 192 7 in The State of the Art in Numerical Analysis (1987) trunk/docsrc/cppstrings.dd
r880 r2040 16 16 it's not adding strings but concatenating them. 17 17 ) 18 $(P Additionally, if one has an array of floats, is '+'overloaded to18 $(P Additionally, if one has an array of floats, is $(SINGLEQUOTE +) overloaded to 19 19 be the same as a vector addition, or an array concatenation? 20 20 ) … … 261 261 This, coupled with no garbage collection, has 262 262 some consequences. First of all, any string created must make 263 its own copy of the string data. The 'owner'of the string263 its own copy of the string data. The $(SINGLEQUOTE owner) of the string 264 264 data must be kept track of, because when the owner is deleted 265 265 all references become invalid. If one tries to avoid the … … 277 277 string data. D strings can refer to data in the static data 278 278 segment, data on the stack, data inside other strings, objects, 279 file buffers, etc. There's no need to keep track of the 'owner'279 file buffers, etc. There's no need to keep track of the $(SINGLEQUOTE owner) 280 280 of the string data. 281 281 ) trunk/docsrc/cpptod.dd
r659 r2040 163 163 164 164 There's a nasty bug lurking in the memcmp() implementation of operator==(). 165 The layout of a struct, due to alignment, can have 'holes'in it.165 The layout of a struct, due to alignment, can have $(SINGLEQUOTE holes) in it. 166 166 C++ does not guarantee those holes are assigned any values, and so 167 167 two different struct instances can have the same value for each member, … … 524 524 than the class definition. 525 525 It obviates the wordy practice of defining get and set properties 526 'just in case'a derived class should need to override them.526 $(SINGLEQUOTE just in case) a derived class should need to override them. 527 527 It's also a way to have interface classes, which do not have 528 528 data fields, behave syntactically as if they did. trunk/docsrc/d-floating-point.dd
r1322 r2040 66 66 $(P Since $(INFIN) can be produced by overflow, both +$(INFIN) and -$(INFIN) are required. Both +0 and -0 are required in order to preserve identities such as: if $(D x>0), then $(D 1/(1/x) > 0). In almost all other cases, however, there is no difference between +0 and -0.) 67 67 68 $(P It's worth noting that these "special values"are usually not very efficient. On x86 machines, for example, a multiplication involving a NaN, an infinity, or a subnormal can be twenty to fifty times slower than an operation on normal numbers. If your numerical code is unexpectedly slow, it's possible that you are inadvertently creating many of these special values. Enabling floating-point exception trapping, described later, is a quick way to confirm this.)68 $(P It's worth noting that these $(SINGLEQUOTE special values) are usually not very efficient. On x86 machines, for example, a multiplication involving a NaN, an infinity, or a subnormal can be twenty to fifty times slower than an operation on normal numbers. If your numerical code is unexpectedly slow, it's possible that you are inadvertently creating many of these special values. Enabling floating-point exception trapping, described later, is a quick way to confirm this.) 69 69 70 70 $(P One of the biggest factor obscuring what the machine is doing is in the conversion between binary and decimal. You can eliminate this by using the $(D "%a") format when displaying results. This is an invaluable debugging tool, and an enormously helpful aid when developing floating-point algorithms. The $(D 0x1.23Ap+6) hexadecimal floating-point format can also be used in source code for ensuring that your input data is $(I exactly) what you intended.) … … 132 132 $(P A key design goal is: it should be possible to write code such that, regardless of the processor which is used, the accuracy is never worse than would be obtained on a system which only supports the $(D double) type.) 133 133 134 $(P (Footnote: $(D real) is close to 'indigenous'in the Borneo proposal for the Java programming language[Ref Borneo]).)134 $(P (Footnote: $(D real) is close to $(SINGLEQUOTE indigenous) in the Borneo proposal for the Java programming language[Ref Borneo]).) 135 135 136 136 $(P Consider evaluating $(D x*y + z*w), where $(D x, y, z) and $(D w) are double.) … … 235 235 $(H2 NaN payloads) 236 236 237 $(P According to the IEEE 754 standard, a 'payload'can be stored in the mantissa of a NaN. This payload can contain information about how or why it was generated. Historically, almost no programming languages have ever made use of this potentially powerful feature. In D, this payload consists of a positive integer.)237 $(P According to the IEEE 754 standard, a $(SINGLEQUOTE payload) can be stored in the mantissa of a NaN. This payload can contain information about how or why it was generated. Historically, almost no programming languages have ever made use of this potentially powerful feature. In D, this payload consists of a positive integer.) 238 238 239 239 $(UL … … 305 305 ) 306 306 307 $(H2 Floating point and 'pure nothrow')307 $(H2 Floating point and $(SINGLEQUOTE pure nothrow)) 308 308 309 309 $(P Every floating point operation, even the most trivial, is affected by the floating-point rounding state, and writes to the sticky flags. The status flags and control state are thus 'hidden variables', potentially affecting every $(D pure) function; and if the floating point traps are enabled, any floating point operation can generate a hardware exception. trunk/docsrc/ddoc.dd
r1825 r2040 517 517 ) 518 518 519 <h4>No Documentation< /h4>519 <h4>No Documentation<h4> 520 520 521 521 $(P … … 554 554 $(P 555 555 Macros can have arguments. Any text from the end of the identifier 556 to the closing '$(RPAREN)'is the $0 argument.556 to the closing $(SINGLEQUOTE $(RPAREN)) is the $0 argument. 557 557 A $0 in the replacement text is 558 558 replaced with the argument text. … … 560 560 argument text up to the first comma, $2 from the first comma to 561 561 the second comma, etc., up to $9. 562 $+ represents the text from the first comma to the closing '$(RPAREN)'.562 $+ represents the text from the first comma to the closing $(SINGLEQUOTE $(RPAREN)). 563 563 The argument text can contain nested parentheses, "" or '' strings, 564 564 <!-- ... --> comments, or tags. trunk/docsrc/declaration.dd
r1564 r2040 418 418 419 419 $(P 420 Aliasing can be used to 'import'a symbol from an import into the420 Aliasing can be used to $(SINGLEQUOTE import) a symbol from an import into the 421 421 current scope: 422 422 ) … … 427 427 428 428 $(P 429 Aliases can also 'import'a set of overloaded functions, that can429 Aliases can also $(SINGLEQUOTE import) a set of overloaded functions, that can 430 430 be overloaded with functions in the current scope: 431 431 ) trunk/docsrc/dstyle.dd
r1912 r2040 56 56 ) 57 57 58 $(LI Use $(CODE version (none)) to 'comment out'a piece of trial code58 $(LI Use $(CODE version (none)) to $(SINGLEQUOTE comment out) a piece of trial code 59 59 that is syntactically valid: 60 60 ------------------------------- … … 84 84 ) 85 85 86 $(LI Use nesting comments to 'comment out'a piece of syntactically invalid code:86 $(LI Use nesting comments to $(SINGLEQUOTE comment out) a piece of syntactically invalid code: 87 87 ------------------------------- 88 88 /+++++ … … 103 103 <dd>Names formed by joining multiple words should have each word 104 104 other than the first capitalized. 105 Names shall not begin with an underscore '_' unless they are private member variables.105 Names shall not begin with an underscore $(SINGLEQUOTE _). 106 106 107 107 ------------------------------- … … 131 131 ------------------------------- 132 132 ) 133 $(DD An exception is that eponymous templates that return a value instead of a type should not be134 capitalized, as they are conceptually more similar to functions.135 136 -------------------------137 template GetSomeType(T) {}138 template isSomeType(T) {}139 -------------------------140 )141 133 142 134 $(DT Function names) … … 148 140 ------------------------------- 149 141 ) 150 142 143 $(DT Const names) 144 $(DD Are in all caps.) 145 151 146 $(DT Enum member names) 152 $(DD are in lowerCamelCase.)147 $(DD Are in all caps.) 153 148 154 149 ) … … 188 183 great potential for creating obfuscated code. In particular, 189 184 the existing D operators have conventional meanings, such 190 as '+' means 'add' and '<<' means 'shift left'. 191 Overloading operator '+' with a meaning different from 'add' 185 as $(SINGLEQUOTE +) means $(SINGLEQUOTE add) and $(SINGLEQUOTE <<) 186 means $(SINGLEQUOTE shift left). 187 Overloading operator $(SINGLEQUOTE +) with a meaning different from $(SINGLEQUOTE add) 192 188 is arbitrarily confusing and should be avoided. 193 189 ) trunk/docsrc/errors.dd
r659 r2040 70 70 to modify the old code to be compatible with new error types.) 71 71 $(LI No errors get inadvertently ignored.) 72 $(LI 'Quick and dirty'utilities can be written that still72 $(LI $(SINGLEQUOTE Quick and dirty) utilities can be written that still 73 73 correctly handle errors.) 74 74 $(LI It is easy to make the error handling source code look good.) trunk/docsrc/exception-safe.dd
r659 r2040 317 317 $(OL 318 318 $(LI Perform the SMTP send operation.) 319 $(LI Copy the email to the "Sent"folder, which in POP is on the local319 $(LI Copy the email to the $(DOUBLEQUOTE Sent) folder, which in POP is on the local 320 320 disk, and in IMAP is also remote.) 321 321 ) 322 322 323 $(P Messages should not appear in "Sent"that haven't been actually sent,324 and sent messages must actually appear in "Sent".323 $(P Messages should not appear in $(DOUBLEQUOTE Sent) that haven't been actually sent, 324 and sent messages must actually appear in $(DOUBLEQUOTE Sent). 325 325 ) 326 326 … … 331 331 332 332 $(OL 333 $(LI Copy the message to "Sent" with a changed title "[Sending]334 <Subject> ". This operation ensures there's space in the client's IMAP333 $(LI Copy the message to $(DOUBLEQUOTE Sent) with a changed title $(DOUBLEQUOTE [Sending] 334 <Subject>). This operation ensures there's space in the client's IMAP 335 335 account (or on the local disk), the rights are proper, the connection 336 336 exists and works, etc.) … … 338 338 $(LI Send the message via SMTP.) 339 339 340 $(LI If sending fails, delete the message from "Sent". If the message340 $(LI If sending fails, delete the message from $(DOUBLEQUOTE Sent). If the message 341 341 succeeds, 342 change its title from "[Sending] <Subject>" to "<Subject>".342 change its title from $(DOUBLEQUOTE [Sending] <Subject>) to $(DOUBLEQUOTE <Subject>). 343 343 Both of these operation have a high probability to succeed. If the 344 344 folder is local, the probability of success is very high. If the folder trunk/docsrc/faq.dd
r1457 r2040 78 78 $(ITEMR nan, Why are floating point values default initialized to NaN rather than 0?) 79 79 $(ITEMR assignmentoverloading, Why is overloading of the assignment operator not supported?) 80 $(ITEMR keys, The '~'is not on my keyboard?)80 $(ITEMR keys, The $(SINGLEQUOTE ~) is not on my keyboard?) 81 81 $(ITEMR omf, Can I link in C object files created with another compiler?) 82 82 $(ITEMR regexp_literals, Why not support regular expression literals … … 440 440 in D 2.0.) 441 441 442 $(ITEM keys, The '~'is not on my keyboard?)442 $(ITEM keys, The $(SINGLEQUOTE ~) is not on my keyboard?) 443 443 444 444 $(P On PC keyboards, hold down the [Alt] key and press the 1, 2, and 6 445 keys in sequence on the numeric pad. That will generate a '~'445 keys in sequence on the numeric pad. That will generate a $(SINGLEQUOTE ~) 446 446 character. 447 447 ) trunk/docsrc/features2.dd
r1366 r2040 30 30 $(LI $(TT std.math.sin), $(TT cos), $(TT tan) are now evaluated at 31 31 compile time if the argument is a constant.) 32 $(LI Added $(LINK2 cpp_interface.html, C++ interface) for 'plugins'.)32 $(LI Added $(LINK2 cpp_interface.html, C++ interface) for $(SINGLEQUOTE plugins).) 33 33 $(LI Changed result type of 34 34 $(LINK2 expression.html#IsExpression, $(I IsExpression)) trunk/docsrc/garbage.dd
r659 r2040 138 138 139 139 $(OL 140 $(LI Looking for all the pointer 'roots'into GC allocated memory.)140 $(LI Looking for all the pointer $(SINGLEQUOTE roots) into GC allocated memory.) 141 141 142 142 $(LI Recursively scanning all allocated memory pointed to by trunk/docsrc/htomodule.dd
r659 r2040 106 106 <h4>Numeric Literals</h4> 107 107 108 Any 'L' or 'l'numeric literal suffixes should be removed,108 Any $(SINGLEQUOTE L) or $(SINGLEQUOTE l) numeric literal suffixes should be removed, 109 109 as a C $(TT long) is (usually) the same size as a D $(TT int). 110 Similarly, 'LL'suffixes should be replaced with a111 single 'L'.112 Any 'u'suffix will work the same in D.110 Similarly, $(SINGLEQUOTE LL) suffixes should be replaced with a 111 single $(SINGLEQUOTE L). 112 Any $(SINGLEQUOTE u) suffix will work the same in D. 113 113 114 114 <h4>String Literals</h4> 115 115 116 In most cases, any 'L'prefix to a string can just be dropped,116 In most cases, any $(SINGLEQUOTE L) prefix to a string can just be dropped, 117 117 as D will implicitly convert strings to wide characters if 118 118 necessary. However, one can also replace: trunk/docsrc/lex.dd
r1422 r2040 20 20 directed editors relatively easy to produce. 21 21 It also is possible to compress D source by storing it in 22 'tokenized'form.22 $(SINGLEQUOTE tokenized) form. 23 23 24 24 $(OL … … 777 777 <p> 778 778 $(LNAME2 binary-literals, Binary integers) are a sequence of binary digits preceded 779 by a '0b'.779 by a $(SINGLEQUOTE 0b). 780 780 <p> 781 Octal integers are a sequence of octal digits preceded by a '0'.781 Octal integers are a sequence of octal digits preceded by a $(SINGLEQUOTE 0). 782 782 <p> 783 783 Hexadecimal integers are a sequence of hexadecimal digits preceded 784 by a '0x'.784 by a $(SINGLEQUOTE 0x). 785 785 <p> 786 Integers can have embedded '_'characters, which are ignored.787 The embedded '_'are useful for formatting long literals, such786 Integers can have embedded $(SINGLEQUOTE _) characters, which are ignored. 787 The embedded $(SINGLEQUOTE _) are useful for formatting long literals, such 788 788 as using them as a thousands separator: 789 789 … … 793 793 ------------- 794 794 795 Integers can be immediately followed by one 'L' or one 'u' or both. 795 Integers can be immediately followed by one $(SINGLEQUOTE L) or one 796 $(SINGLEQUOTE u) or both. 796 797 <p> 797 798 The type of the integer is resolved as follows: … … 971 972 <p> 972 973 973 Floating literals can have embedded '_'characters, which are ignored.974 The embedded '_'are useful for formatting long literals to974 Floating literals can have embedded $(SINGLEQUOTE _) characters, which are ignored. 975 The embedded $(SINGLEQUOTE _) are useful for formatting long literals to 975 976 make them more readable, such 976 977 as using them as a thousands separator: trunk/docsrc/lisp-java-d.dd
r659 r2040 56 56 <p>During the actual programming I did not have to stop and think about anything. 57 57 The program evolved automatically, once I thought of the actual container for 58 the dictionary. It turned out that the 'winning'Lisp version was storing the58 the dictionary. It turned out that the $(SINGLEQUOTE winning) Lisp version was storing the 59 59 dictionary in a similar manner.</p> 60 60 <h2>Compiling</h2> trunk/docsrc/memory.dd
r1824 r2040 327 327 328 328 $(P Mark/Release is equivalent to a stack method of allocating and 329 freeing memory. A 'stack'is created in memory. Objects are allocated329 freeing memory. A $(SINGLEQUOTE stack) is created in memory. Objects are allocated 330 330 by simply moving a pointer down the stack. Various points are 331 'marked', and then whole sections of memory are released331 $(SINGLEQUOTE marked), and then whole sections of memory are released 332 332 simply by resetting the stack pointer back to a marked point. 333 333 ) trunk/docsrc/module.dd
r1577 r2040 367 367 Sometimes, it's necessary to override the usual lexical scoping rules 368 368 to access a name hidden by a local name. This is done with the 369 global scope operator, which is a leading '.':369 global scope operator, which is a leading $(SINGLEQUOTE .): 370 370 371 371 --------- … … 381 381 --------- 382 382 383 The leading '.'means look up the name at the module scope level.383 The leading $(SINGLEQUOTE .) means look up the name at the module scope level. 384 384 385 385 <a name="staticorder"><h2>Static Construction and Destruction</h2></a> trunk/docsrc/operatoroverloading.dd
r1564 r2040 262 262 --- 263 263 264 $(P and the one with the 'better'match is selected.264 $(P and the one with the $(SINGLEQUOTE better) match is selected. 265 265 It is an error for both to equally match. 266 266 ) trunk/docsrc/overview.dd
r1638 r2040 78 78 features for the purpose of compensating for primitive compiler 79 79 technology can be omitted. (An 80 example of this would be the 'register'keyword in C, a more80 example of this would be the $(SINGLEQUOTE register) keyword in C, a more 81 81 subtle example is the macro 82 82 preprocessor in C.) trunk/docsrc/pragma.dd
r1375 r2040 12 12 $(P Pragmas are a way to pass special information to the compiler 13 13 and to add vendor specific extensions to D. 14 Pragmas can be used by themselves terminated with a ';',14 Pragmas can be used by themselves terminated with a $(SINGLEQUOTE ;), 15 15 they can influence a statement, a block of statements, a declaration, or 16 16 a block of declarations. trunk/docsrc/pretod.dd
r659 r2040 707 707 ) 708 708 709 $(LI Mixin argument replacements don't need to be 'protected'with709 $(LI Mixin argument replacements don't need to be $(SINGLEQUOTE protected) with 710 710 parentheses to avoid operator precedence regrouping. 711 711 ) trunk/docsrc/property.dd
r1360 r2040 25 25 $(TR $(TD .sizeof) $(TD size in bytes (equivalent to C's sizeof(type)))) 26 26 $(TR $(TD .alignof) $(TD alignment size)) 27 $(TR $(TD .mangleof) $(TD string representing the 'mangled'representation of the type))27 $(TR $(TD .mangleof) $(TD string representing the $(SINGLEQUOTE mangled) representation of the type)) 28 28 $(TR $(TD .stringof) $(TD string representing the source representation of the type)) 29 29 ) trunk/docsrc/rationale.dd
r659 r2040 12 12 13 13 $(P This is the way C++ does it, and it is appealing to be able 14 to refer to overloading '+' with 'operator+'. The trouble is14 to refer to overloading $(SINGLEQUOTE +) with $(SINGLEQUOTE operator+). The trouble is 15 15 things don't quite fit. For example, there are the 16 16 comparison operators <, <=, >, and >=. In C++, all four must … … 116 116 ?</h3> 117 117 118 Let's rephrase that as "if there's a way to express it in the existing119 language, why build it in to the core language? "118 Let's rephrase that as $(DOUBLEQUOTE if there's a way to express it in the existing 119 language, why build it in to the core language?) 120 120 In regards to T.infinity: 121 121 … … 136 136 137 137 $(LI The worst, though, is the lengths gone to just to get at infinity, 138 implying "the language and compiler don't know anything about IEEE 754139 floating point - so it cannot be relied on. "And in fact138 implying $(DOUBLEQUOTE the language and compiler don't know anything about IEEE 754 139 floating point - so it cannot be relied on.) And in fact 140 140 many otherwise excellent C++ compilers 141 141 do not handle NaN's correctly in floating point comparisons. trunk/docsrc/regular-expression.dd
r659 r2040 41 41 42 42 $(P If the $(I pattern) contains backslash characters \, 43 wysiwyg string literals are used, which have the 'r'prefix43 wysiwyg string literals are used, which have the $(SINGLEQUOTE r) prefix 44 44 to the string. $(I r) and $(I s) are of type $(B RegExp), but 45 45 we can use type inference to declare and assign them automatically: trunk/docsrc/safed.dd
r1163 r2040 14 14 15 15 $(P 16 The universal reason I've heard from the turncoats was "productivity."The consensus seems to be that programmers are more productive using Java, C#, Ruby, or Python then they are using C++.16 The universal reason I've heard from the turncoats was $(DOUBLEQUOTE productivity.) The consensus seems to be that programmers are more productive using Java, C#, Ruby, or Python then they are using C++. 17 17 ) 18 18 trunk/docsrc/statement.dd
r1497 r2040 228 228 <p> 229 229 230 The 'dangling else'parsing problem is solved by associating the230 The $(SINGLEQUOTE dangling else) parsing problem is solved by associating the 231 231 else with the nearest if statement. 232 232 <p> … … 893 893 -------------- 894 894 895 $(P Case statements 'fall through'to subsequent895 $(P Case statements $(SINGLEQUOTE fall through) to subsequent 896 896 case values. A break statement will exit the switch $(I BlockStatement). 897 897 For example: trunk/docsrc/struct.dd
r1399 r2040 610 610 The postblit has access only to the destination struct object, 611 611 not the source. 612 Its job is to 'fix up'the destination as necessary, such as612 Its job is to $(SINGLEQUOTE fix up) the destination as necessary, such as 613 613 making copies of referenced data, incrementing reference counts, 614 614 etc. For example: trunk/docsrc/template-mixin.dd
r1425 r2040 34 34 is defined. It is analogous to cutting and pasting the body of 35 35 the template into the location of the mixin. It is useful for injecting 36 parameterized 'boilerplate'code, as well as for creating36 parameterized $(SINGLEQUOTE boilerplate) code, as well as for creating 37 37 templated nested functions, which is not possible with 38 38 template instantiations. … … 189 189 <h2>Mixin Scope</h2> 190 190 191 The declarations in a mixin are 'imported'into the surrounding191 The declarations in a mixin are $(SINGLEQUOTE imported) into the surrounding 192 192 scope. If the name of a declaration in a mixin is the same 193 193 as a declaration in the surrounding scope, the surrounding declaration trunk/docsrc/templates-revisited.dd
r659 r2040 279 279 U:I, // U must be a class that 280 280 // implements interface I 281 char[] string= "hello",281 string str = "hello", 282 282 // string literal, 283 283 // default is "hello" … … 295 295 $(P 296 296 Partial and explicit specialization work as they do in C++, except that 297 there is no notion of a 'primary'template. All the templates with the297 there is no notion of a $(SINGLEQUOTE primary) template. All the templates with the 298 298 same name are examined upon template instantiation, and the one with the 299 299 best fit of arguments to parameters is instantiated. … … 630 630 template decimalDigit(int n) // [3] 631 631 { 632 const char[]decimalDigit = "0123456789"[n..n+1];632 const string decimalDigit = "0123456789"[n..n+1]; 633 633 } 634 634 … … 636 636 { 637 637 static if (n < 0) 638 const char[]itoa = "-" ~ itoa!(-n);638 const string itoa = "-" ~ itoa!(-n); 639 639 else static if (n < 10) 640 const char[]itoa = decimalDigit!(n);641 else 642 const char[]itoa = itoa!(n/10L) ~ decimalDigit!(n%10L);643 } 644 645 char[]foo()640 const string itoa = decimalDigit!(n); 641 else 642 const string itoa = itoa!(n/10L) ~ decimalDigit!(n%10L); 643 } 644 645 string foo() 646 646 { 647 647 return itoa!(264); // returns "264" … … 728 728 */ 729 729 730 template regexMatch( char[]pattern)731 { 732 char[][] regexMatch(char[]str)733 { 734 char[][] results;730 template regexMatch(string pattern) 731 { 732 string[] regexMatch(string str) 733 { 734 string[] results; 735 735 int n = regexCompile!(pattern).fn(str); 736 736 if (n != testFail && n > 0) … … 745 745 * 746 746 * Params: 747 * char[]str the input string to match against747 * string str the input string to match against 748 748 * 749 749 * Returns: … … 755 755 template testEmpty() 756 756 { 757 int testEmpty( char[]str) { return 0; }757 int testEmpty(string str) { return 0; } 758 758 } 759 759 … … 761 761 template testUnion(alias testFirst, alias testSecond) 762 762 { 763 int testUnion( char[]str)763 int testUnion(string str) 764 764 { 765 765 int n1 = testFirst(str); … … 775 775 776 776 /// Match if first part of str[] matches text[] 777 template testText( char[]text)778 { 779 int testText( char[]str)777 template testText(string text) 778 { 779 int testText(string str) 780 780 { 781 781 if (str.length && … … 791 791 template testZeroOrMore(alias testPredicate) 792 792 { 793 int testZeroOrMore( char[]str)793 int testZeroOrMore(string str) 794 794 { 795 795 if (str.length == 0) … … 808 808 809 809 /// Match if term1[0] <= str[0] <= term2[0] 810 template testRange( char[] term1, char[]term2)811 { 812 int testRange( char[]str)810 template testRange(string term1, string term2) 811 { 812 int testRange(string str) 813 813 { 814 814 if (str.length && str[0] >= term1[0] … … 820 820 821 821 /// Match if ch[0]==str[0] 822 template testChar( char[]ch)823 { 824 int testChar( char[]str)822 template testChar(string ch) 823 { 824 int testChar(string str) 825 825 { 826 826 if (str.length && str[0] == ch[0]) … … 833 833 template testWordChar() 834 834 { 835 int testWordChar( char[]str)835 int testWordChar(string str) 836 836 { 837 837 if (str.length && … … 857 857 */ 858 858 859 template parseTextToken( char[]pattern)859 template parseTextToken(string pattern) 860 860 { 861 861 static if (pattern.length > 0) 862 862 { 863 863 static if (isSpecial!(pattern)) 864 const char[]parseTextToken = "";864 const string parseTextToken = ""; 865 865 else 866 const char[]parseTextToken =866 const string parseTextToken = 867 867 pattern[0..1] ~ parseTextToken!(pattern[1..$]); 868 868 } 869 869 else 870 const char[]parseTextToken="";870 const string parseTextToken=""; 871 871 } 872 872 … … 877 877 * consumed number of characters in pattern[] parsed 878 878 */ 879 template parseUntil( char[]pattern,char terminator,bool fuzzy=false)879 template parseUntil(string pattern,char terminator,bool fuzzy=false) 880 880 { 881 881 static if (pattern.length > 0) … … 885 885 static if (pattern.length > 1) 886 886 { 887 const char[]nextSlice = pattern[2 .. $];887 const string nextSlice = pattern[2 .. $]; 888 888 alias parseUntil!(nextSlice,terminator,fuzzy) next; 889 const char[]token = pattern[0 .. 2] ~ next.token;889 const string token = pattern[0 .. 2] ~ next.token; 890 890 const uint consumed = next.consumed+2; 891 891 } … … 898 898 else static if (pattern[0] == terminator) 899 899 { 900 const char[]token="";900 const string token=""; 901 901 const uint consumed = 1; 902 902 } 903 903 else 904 904 { 905 const char[]nextSlice = pattern[1 .. $];905 const string nextSlice = pattern[1 .. $]; 906 906 alias parseUntil!(nextSlice,terminator,fuzzy) next; 907 const char[]token = pattern[0..1] ~ next.token;907 const string token = pattern[0..1] ~ next.token; 908 908 const uint consumed = next.consumed+1; 909 909 } … … 911 911 else static if (fuzzy) 912 912 { 913 const char[]token = "";913 const string token = ""; 914 914 const uint consumed = 0; 915 915 } … … 932 932 */ 933 933 934 template regexCompileCharClass2( char[]pattern)934 template regexCompileCharClass2(string pattern) 935 935 { 936 936 static if (pattern.length > 0) … … 944 944 alias testRange!(pattern[0..1], pattern[2..3]) termFn; 945 945 const uint thisConsumed = 3; 946 const char[]remaining = pattern[3 .. $];946 const string remaining = pattern[3 .. $]; 947 947 } 948 948 else // length is 2 … … 957 957 alias testChar!(pattern[0..1]) termFn; 958 958 const uint thisConsumed = 1; 959 const char[]remaining = pattern[1 .. $];959 const string remaining = pattern[1 .. $]; 960 960 } 961 961 } … … 964 964 alias testChar!(pattern[0..1]) termFn; 965 965 const uint thisConsumed = 1; 966 const char[]remaining = pattern[1 .. $];966 const string remaining = pattern[1 .. $]; 967 967 } 968 968 alias regexCompileCharClassRecurse!(termFn,remaining) recurse; … … 988 988 */ 989 989 990 template regexCompileCharClassRecurse(alias termFn, char[]pattern)990 template regexCompileCharClassRecurse(alias termFn,string pattern) 991 991 { 992 992 static if (pattern.length > 0 && pattern[0] != ']') … … 1012 1012 */ 1013 1013 1014 template regexCompileCharClass( char[]pattern)1014 template regexCompileCharClass(string pattern) 1015 1015 { 1016 1016 static if (pattern.length > 0) … … 1045 1045 */ 1046 1046 1047 template regexCompilePredicate(alias test, char[]pattern)1047 template regexCompilePredicate(alias test, string pattern) 1048 1048 { 1049 1049 static if (pattern.length > 0 && pattern[0] == '*') … … 1068 1068 */ 1069 1069 1070 template regexCompileEscape( char[]pattern)1070 template regexCompileEscape(string pattern) 1071 1071 { 1072 1072 static if (pattern.length > 0) … … 1103 1103 */ 1104 1104 1105 template regexCompile( char[]pattern)1105 template regexCompile(string pattern) 1106 1106 { 1107 1107 static if (pattern.length > 0) … … 1109 1109 static if (pattern[0] == '[') 1110 1110 { 1111 const char[]charClassToken =1111 const string charClassToken = 1112 1112 parseUntil!(pattern[1 .. $],']').token; 1113 1113 alias regexCompileCharClass!(charClassToken) charClass; 1114 const char[]token = pattern[0 .. charClass.consumed+2];1115 const char[]next = pattern[charClass.consumed+2 .. $];1114 const string token = pattern[0 .. charClass.consumed+2]; 1115 const string next = pattern[charClass.consumed+2 .. $]; 1116 1116 alias charClass.fn test; 1117 1117 } … … 1119 1119 { 1120 1120 alias regexCompileEscape!(pattern[1..pattern.length]) escapeSequence; 1121 const char[]token = pattern[0 .. escapeSequence.consumed+1];1122 const char[]next =1121 const string token = pattern[0 .. escapeSequence.consumed+1]; 1122 const string next = 1123 1123 pattern[escapeSequence.consumed+1 .. $]; 1124 1124 alias escapeSequence.fn test; … … 1126 1126 else 1127 1127 { 1128 const char[]token = parseTextToken!(pattern);1128 const string token = parseTextToken!(pattern); 1129 1129 static assert(token.length > 0); 1130 const char[]next = pattern[token.length .. $];1130 const string next = pattern[token.length .. $]; 1131 1131 alias testText!(token) test; 1132 1132 } 1133 1133 1134 1134 alias regexCompilePredicate!(test, next) term; 1135 const char[]remaining = next[term.consumed .. next.length];1135 const string remaining = next[term.consumed .. next.length]; 1136 1136 1137 1137 alias regexCompileRecurse!(term,remaining).fn fn; … … 1141 1141 } 1142 1142 1143 template regexCompileRecurse(alias term, char[]pattern)1143 template regexCompileRecurse(alias term,string pattern) 1144 1144 { 1145 1145 static if (pattern.length > 0) … … 1153 1153 1154 1154 /// Utility function for parsing 1155 template isSpecial( char[]pattern)1155 template isSpecial(string pattern) 1156 1156 { 1157 1157 static if ( trunk/docsrc/traits.dd
r1457 r2040 320 320 $(P Takes two arguments, the second must be a string. 321 321 The result is an expression formed from the first 322 argument, followed by a '.', followed by the second322 argument, followed by a $(SINGLEQUOTE .), followed by the second 323 323 argument as an identifier. 324 324 ) trunk/docsrc/tuple.dd
r659 r2040 42 42 43 43 $(P Tuples can be used as arguments to templates, and if so 44 they are 'flattened'out into a list of arguments.44 they are $(SINGLEQUOTE flattened) out into a list of arguments. 45 45 This makes it straightforward to append a new element to 46 46 an existing tuple or concatenate tuples:) … … 82 82 --- 83 83 84 $(P These make it simple to produce the 'head' and 'tail'84 $(P These make it simple to produce the $(SINGLEQUOTE head) and $(SINGLEQUOTE tail) 85 85 of a tuple. The head is just TP[0], the tail 86 86 is TP[1 .. length]. trunk/docsrc/warnings.dd
r659 r2040 4 4 5 5 $(P Depending on one's point of view, warnings are either a symptom 6 of broken language design or a useful 'lint'like tool to analyze6 of broken language design or a useful $(SINGLEQUOTE lint) like tool to analyze 7 7 code and look for potential trouble spots. 8 8 Most of the time, those trouble spots will be legitimate code … … 109 109 variable $(I length) gets defined and set to be the length 110 110 of that array. The scope of the $(I length) is from the opening 111 '[' to the closing ']'.111 $(SINGLEQUOTE [) to the closing $(SINGLEQUOTE ]). 112 112 ) 113 113
