OLD | NEW |
---|---|
1 <?xml version="1.0" encoding="UTF-8"?> | 1 <?xml version="1.0" encoding="UTF-8"?> |
2 <!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" | 2 <!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> | 3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
4 <preface id="preface"> | 4 <preface id="preface"> |
5 <?dbhtml stop-chunking?> | 5 <?dbhtml stop-chunking?> |
6 | 6 |
7 <title>Preface</title> | 7 <title>Preface</title> |
8 | 8 |
9 <para>You don’t need to be an expert web developer to build web apps. With | 9 <para>You don’t need to be an expert web developer to build web apps. With |
10 Dart, you can be productive as you build high-performance apps for the | 10 Dart, you can be productive as you build high-performance apps for the |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 | 197 |
198 <sect1 id="preface-updates"> | 198 <sect1 id="preface-updates"> |
199 <title>Content Updates</title> | 199 <title>Content Updates</title> |
200 | 200 |
201 <para>This section gives details about how the book has changed since its | 201 <para>This section gives details about how the book has changed since its |
202 first and second printings.</para> | 202 first and second printings.</para> |
203 | 203 |
204 <sect2 id="preface-updates-v3"> | 204 <sect2 id="preface-updates-v3"> |
205 <title>Changes After the Second Printing</title> | 205 <title>Changes After the Second Printing</title> |
206 | 206 |
207 <para>We’ve updated the content to reflect the following M4 | 207 <para>We've changed the text and examples to reflect these language |
208 changes:</para> | 208 changes:</para> |
209 | 209 |
210 <itemizedlist> | 210 <itemizedlist> |
211 <listitem> | 211 <listitem> |
212 <para>File’s <literal>openWrite()</literal> method now has no | 212 <para>Instance variables can no longer be <literal>const</literal>. |
213 required parameters but two optional named parameters. The | 213 Use <literal>static const</literal> variables instead.</para> |
sethladd
2013/12/04 19:06:01
you said instance variables, but you mention stati
| |
214 <literal>mode</literal> parameter has a default value of | |
215 <literal>FileMode.WRITE</literal>.</para> | |
216 </listitem> | 214 </listitem> |
217 | 215 |
218 <listitem> | 216 <listitem> |
219 <para>File’s <literal>readAsString()</literal> and | 217 <para>The <literal>?</literal> operator for testing whether an |
220 <literal>readAsLines()</literal> methods no longer require a | 218 optional parameter has been set is no longer in the language.</para> |
221 parameter. Instead, they have an optional named parameter | |
222 (<literal>encoding</literal>), with a default value of | |
223 <literal>Encoding.UTF_8</literal>.</para> | |
224 </listitem> | 219 </listitem> |
225 | 220 |
226 <listitem> | 221 <listitem> |
227 <para>IOSink’s methods for writing data have changed. To write | 222 <para>Keys in map literals no longer need to be strings.</para> |
228 string data, instead of <literal>addString()</literal> use | |
229 <literal>write()</literal>. The method for writing binary data was | |
230 temporarily renamed to <literal>writeBytes()</literal>, but is now | |
231 back to <literal>add()</literal>.</para> | |
232 </listitem> | 223 </listitem> |
233 | 224 |
234 <listitem> | 225 <listitem> |
226 <para>Dart now has Symbols and symbol literals | |
227 (<literal>#<replaceable>identifier</replaceable></literal>): <xref | |
228 linkend="ch02-symbols" />.</para> | |
229 </listitem> | |
230 | |
231 <listitem> | |
232 <para>Function equality testing is easier: <xref | |
233 linkend="ch02-function-equality" />.</para> | |
234 </listitem> | |
235 | |
236 <listitem> | |
237 <para>Bitwise operators have higher precedence than they used | |
238 to.</para> | |
239 </listitem> | |
240 </itemizedlist> | |
241 | |
242 <para>We've also updated the content to reflect API changes. In | |
243 dart:core:</para> | |
244 | |
245 <itemizedlist> | |
246 <listitem> | |
235 <para>Set’s <literal>isSubsetOf()</literal> method is gone. Instead, | 247 <para>Set’s <literal>isSubsetOf()</literal> method is gone. Instead, |
236 use the Set <literal>containsAll()</literal> method. You can convert | 248 use the Set <literal>containsAll()</literal> method. You can convert |
237 any Iterable to a Set using <literal>toSet()</literal>.</para> | 249 any Iterable to a Set using <literal>toSet()</literal>.</para> |
238 </listitem> | 250 </listitem> |
239 | 251 |
240 <listitem> | 252 <listitem> |
241 <para>The Collection class is gone, so we’ve changed the way we | 253 <para>The Collection class is gone, so we’ve changed the way we |
242 talked about sets, lists, and maps in <xref | 254 talked about sets, lists, and maps in <xref |
243 linkend="ch03-collections" />, and we talk more about | 255 linkend="ch03-collections" />, and we talk more about |
244 Iterable.</para> | 256 Iterable.</para> |
245 </listitem> | 257 </listitem> |
246 | 258 |
247 <listitem> | 259 <listitem> |
248 <para>The AsyncError class has been removed.</para> | 260 <para>The functionality in the former dart:uri library is now in the |
249 </listitem> | 261 Uri class in dart:core. The top-level functions |
250 </itemizedlist> | |
251 | |
252 <para>M5 introduced additional changes:</para> | |
253 | |
254 <itemizedlist> | |
255 <listitem> | |
256 <para>The dart_analyzer tool has been replaced by | |
257 dartanalyzer.</para> | |
258 </listitem> | |
259 | |
260 <listitem> | |
261 <para>Instance variables can no longer be <literal>const</literal>. | |
262 Use <literal>static const</literal> variables instead.</para> | |
263 </listitem> | |
264 | |
265 <listitem> | |
266 <para>The <literal>?</literal> operator for testing whether an | |
267 optional parameter has been set is no longer in the language.</para> | |
268 </listitem> | |
269 | |
270 <listitem> | |
271 <para>The dart:crypto library has moved out of the SDK (to <ulink | |
272 url="http://pub.dartlang.org/packages/crypto">http://pub.dartlang.org/ packages/crypto</ulink>).</para> | |
273 </listitem> | |
274 | |
275 <listitem> | |
276 <para>The dart:uri library is gone, its functionality folded into a | |
277 new Uri class in dart:core. The top-level functions | |
278 <literal>encodeUri()</literal>, | 262 <literal>encodeUri()</literal>, |
279 <literal>encodeUriComponent()</literal>, | 263 <literal>encodeUriComponent()</literal>, |
280 <literal>decodeUri()</literal>, and | 264 <literal>decodeUri()</literal>, and |
281 <literal>decodeUriComponent()</literal> are now static methods in | 265 <literal>decodeUriComponent()</literal> are now static methods in |
282 Uri named (respectively) <literal>encodeFull()</literal>, | 266 Uri named (respectively) <literal>encodeFull()</literal>, |
283 <literal>encodeComponent()</literal>, | 267 <literal>encodeComponent()</literal>, |
284 <literal>decodeFull()</literal>, and | 268 <literal>decodeFull()</literal>, and |
285 <literal>decodeComponent()</literal>. To create a Uri from a string, | 269 <literal>decodeComponent()</literal>. To create a Uri from a string, |
286 you now use the static <literal>parse()</literal> method. Uri now | 270 you now use the static <literal>parse()</literal> method. Uri now |
287 has a single constructor, which takes the arguments that the | 271 has a single constructor, which takes the arguments that the |
288 <literal>Uri.fromComponents()</literal> constructor used to take. | 272 <literal>Uri.fromComponents()</literal> constructor used to take. |
289 Finally, the <literal>domain</literal> field is now named | 273 Finally, the <literal>domain</literal> field is now named |
290 <literal>host</literal>.</para> | 274 <literal>host</literal>.</para> |
291 </listitem> | 275 </listitem> |
292 </itemizedlist> | |
293 | |
294 <itemizedlist> | |
295 <listitem> | |
296 <para>The dartdoc <literal>--pkg</literal> command-line option is | |
297 now <literal>--package-root</literal>.</para> | |
298 </listitem> | |
299 </itemizedlist> | |
300 | |
301 <para>M6, M7, and M8 introduced additional changes:</para> | |
302 | |
303 <itemizedlist> | |
304 <listitem> | |
305 <para>Keys in map literals no longer need to be strings.</para> | |
306 </listitem> | |
307 | |
308 <listitem> | |
309 <para>Dart now has Symbols and symbol literals | |
310 (<literal>#<replaceable>identifier</replaceable></literal>): <xref | |
311 linkend="ch02-symbols" />.</para> | |
312 </listitem> | |
313 | |
314 <listitem> | |
315 <para>Function equality testing is easier: <xref | |
316 linkend="ch02-function-equality" />.</para> | |
317 </listitem> | |
318 | |
319 <listitem> | |
320 <para>Bitwise operators have higher precedence than they used | |
321 to.</para> | |
322 </listitem> | |
323 | 276 |
324 <listitem> | 277 <listitem> |
325 <para>The @deprecated, @override, and @proxy annotations moved from | 278 <para>The @deprecated, @override, and @proxy annotations moved from |
326 the meta package to dart:core.</para> | 279 the meta package to dart:core.</para> |
327 </listitem> | 280 </listitem> |
281 </itemizedlist> | |
282 | |
283 <para>In dart:io:</para> | |
284 | |
285 <itemizedlist> | |
286 <listitem> | |
287 <para>File’s <literal>openWrite()</literal> method now has no | |
288 required parameters but two optional named parameters. The | |
289 <literal>mode</literal> parameter has a default value of | |
290 <literal>FileMode.WRITE</literal>.</para> | |
291 </listitem> | |
328 | 292 |
329 <listitem> | 293 <listitem> |
294 <para>File’s <literal>readAsString()</literal> and | |
295 <literal>readAsLines()</literal> methods no longer require a | |
296 parameter. Instead, they have an optional named parameter | |
297 (<literal>encoding</literal>), with a default value of | |
298 <literal>Encoding.UTF_8</literal>.</para> | |
299 </listitem> | |
300 | |
301 <listitem> | |
302 <para>IOSink’s methods for writing data have changed. To write | |
303 string data, instead of <literal>addString()</literal> use | |
304 <literal>write()</literal>. The method for writing binary data was | |
305 temporarily renamed to <literal>writeBytes()</literal>, but reverted | |
306 back to <literal>add()</literal>.</para> | |
307 </listitem> | |
308 </itemizedlist> | |
309 | |
310 <para>A new dart:convert library replaces dart:json and dart:uri:</para> | |
311 | |
312 <itemizedlist> | |
313 <listitem> | |
314 <para>Instead of a StringDecoder, use | |
315 <literal>UTF8.decoder</literal> to convert UTF-8 characters into a | |
316 Dart string.</para> | |
317 </listitem> | |
318 | |
319 <listitem> | |
320 <para>Instead of a LineTransformer, use a LineSplitter object to | |
321 split a stream of strings into a stream of individual lines.</para> | |
322 </listitem> | |
323 | |
324 <listitem> | |
325 <para>Where you used to use dart:json's top-level | |
326 <literal>parse()</literal> and <literal>stringify()</literal> | |
327 functions, use <literal>JSON.decode()</literal> and | |
328 <literal>JSON.encode()</literal>, respectively.</para> | |
329 </listitem> | |
330 | |
331 <listitem> | |
332 <para>Where you used to use dart:uri's top-level | |
333 <literal>decodeUri()</literal> and <literal>encodeUri()</literal> | |
334 functions, use <literal>UTF8.decode()</literal> and | |
335 <literal>UTF8.encode()</literal>, respectively.</para> | |
336 </listitem> | |
337 </itemizedlist> | |
338 | |
339 <para>Other API changes include:</para> | |
340 | |
341 <itemizedlist> | |
342 <listitem> | |
343 <para>In dart:html, the <literal>query()</literal> and | |
344 <literal>queryAll()</literal> methods changed to | |
345 <literal>querySelector()</literal> and | |
346 <literal>querySelectorAll()</literal>, respectively.</para> | |
347 </listitem> | |
348 | |
349 <listitem> | |
350 <para>The dart:crypto library moved out of the SDK (to <ulink | |
351 url="http://pub.dartlang.org/packages/crypto">http://pub.dartlang.org/ packages/crypto</ulink>).</para> | |
352 </listitem> | |
353 | |
354 <listitem> | |
355 <para>The AsyncError class was removed (from dart:async).</para> | |
356 </listitem> | |
357 | |
358 <listitem> | |
359 <para>The dart:isolate library was refactored to have only core | |
360 primitives. We removed its coverage from the book but expect higher | |
361 level APIs to come along that make using isolates easier.</para> | |
362 </listitem> | |
363 | |
364 <listitem> | |
330 <para>The main() function now takes an optional argument | 365 <para>The main() function now takes an optional argument |
331 (List<String>).</para> | 366 (List<String>).</para> |
332 </listitem> | 367 </listitem> |
333 </itemizedlist> | 368 </itemizedlist> |
334 | 369 |
370 <para>The sections that talk about tools have changed, too:</para> | |
371 | |
372 <itemizedlist> | |
373 <listitem> | |
374 <para>The dart_analyzer tool has been replaced by | |
375 dartanalyzer.</para> | |
376 </listitem> | |
377 | |
378 <listitem> | |
379 <para>Command-line arguments for many tools have changed. For | |
380 example, the dartdoc <literal>--pkg</literal> command-line option | |
381 changed to <literal>--package-root</literal>.</para> | |
382 </listitem> | |
383 | |
384 <listitem> | |
385 <para>The pub tool now has build and serve commands, which work with | |
386 transformers to convert your source files into their final | |
387 format.</para> | |
388 </listitem> | |
389 | |
390 <listitem> | |
391 <para>We fleshed out the dart2js docs.</para> | |
392 </listitem> | |
393 </itemizedlist> | |
394 | |
335 <para>We also added new coverage of previously undocumented features and | 395 <para>We also added new coverage of previously undocumented features and |
336 tweaked existing coverage:</para> | 396 tweaked existing coverage. In the language tour:</para> |
337 | 397 |
338 <itemizedlist> | 398 <itemizedlist> |
339 <listitem> | 399 <listitem> |
340 <para>Added <xref linkend="ch02-mixins" />.</para> | 400 <para>Added <xref linkend="ch02-mixins" />.</para> |
341 </listitem> | 401 </listitem> |
342 | 402 |
343 <listitem> | 403 <listitem> |
344 <para>Added <xref linkend="ch03-mirrors" />.</para> | |
345 </listitem> | |
346 | |
347 <listitem> | |
348 <para>In <xref linkend="ch02-keywords" />, marked which keywords are | 404 <para>In <xref linkend="ch02-keywords" />, marked which keywords are |
349 built-in identifiers and discussed how they differ from reserved | 405 built-in identifiers and discussed how they differ from reserved |
350 words.</para> | 406 words.</para> |
351 </listitem> | 407 </listitem> |
352 | 408 |
353 <listitem> | 409 <listitem> |
354 <para>Added coverage of the + operator for strings.</para> | 410 <para>Added coverage of the + operator for strings.</para> |
355 </listitem> | 411 </listitem> |
356 | 412 |
357 <listitem> | 413 <listitem> |
358 <para>Fleshed out dart2js docs.</para> | |
359 </listitem> | |
360 | |
361 <listitem> | |
362 <para>Removed the incorrect <literal>new</literal> from the example | |
363 of using Future.wait().</para> | |
364 </listitem> | |
365 | |
366 <listitem> | |
367 <para>Discussed using expressions (such as function calls) as | 414 <para>Discussed using expressions (such as function calls) as |
368 arguments to a non-default constructor.</para> | 415 arguments to a non-default constructor.</para> |
369 </listitem> | 416 </listitem> |
370 | 417 |
371 <listitem> | 418 <listitem> |
372 <para>Added examples of using the @override and @proxy | 419 <para>Added examples of using the @override and @proxy |
373 annotations.</para> | 420 annotations.</para> |
374 </listitem> | 421 </listitem> |
375 | 422 |
376 <listitem> | 423 <listitem> |
377 <para>Changed the doc comment example to match the latest | 424 <para>Changed the doc comment example to match the latest |
378 guidelines, and pointed to <ulink | 425 guidelines, and pointed to <ulink |
379 url="https://www.dartlang.org/articles/doc-comment-guidelines/">Guidel ines | 426 url="https://www.dartlang.org/articles/doc-comment-guidelines/">Guidel ines |
380 for Dart Doc Comments.</ulink></para> | 427 for Dart Doc Comments.</ulink></para> |
381 </listitem> | 428 </listitem> |
382 </itemizedlist> | 429 </itemizedlist> |
430 | |
431 <para>In the library tour:</para> | |
432 | |
433 <itemizedlist> | |
434 <listitem> | |
435 <para>Added <xref linkend="ch03-mirrors" />.</para> | |
436 </listitem> | |
437 | |
438 <listitem> | |
439 <para>Added examples of parsing non-decimal numbers.</para> | |
440 </listitem> | |
441 | |
442 <listitem> | |
443 <para>Removed the incorrect <literal>new</literal> from the example | |
444 of using Future.wait().</para> | |
445 </listitem> | |
446 | |
447 <listitem> | |
448 <para>Removed coverage of Completer, which is no longer | |
449 recommended.</para> | |
450 </listitem> | |
451 | |
452 <listitem> | |
453 <para>Added <xref linkend="ch03-streams" />.</para> | |
454 </listitem> | |
455 </itemizedlist> | |
456 | |
457 <para>Throughout the book, we updated links to related topics.</para> | |
383 </sect2> | 458 </sect2> |
384 | 459 |
385 <sect2 id="preface-updates-v2"> | 460 <sect2 id="preface-updates-v2"> |
386 <title>Changes in the Second Printing: March 29, 2013</title> | 461 <title>Changes in the Second Printing: March 29, 2013</title> |
387 | 462 |
388 <para>We’ve updated the content to reflect the following changes since | 463 <para>We’ve updated the content to reflect the following changes since |
389 the first printing:</para> | 464 the first printing:</para> |
390 | 465 |
391 <itemizedlist> | 466 <itemizedlist> |
392 <listitem> | 467 <listitem> |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
712 work and helped us make some last-minute fixes that improved the final | 787 work and helped us make some last-minute fixes that improved the final |
713 result. We’d also like to thank the good people who manage the author | 788 result. We’d also like to thank the good people who manage the author |
714 workflow and make working on an O’Reilly book such a pleasure. We | 789 workflow and make working on an O’Reilly book such a pleasure. We |
715 personally worked with Sarah Schneider, Jessica Hosman, and Rachel | 790 personally worked with Sarah Schneider, Jessica Hosman, and Rachel |
716 James.</para> | 791 James.</para> |
717 | 792 |
718 <para>Finally, we thank Lars Bak and Kasper Lund for writing the foreword, | 793 <para>Finally, we thank Lars Bak and Kasper Lund for writing the foreword, |
719 and most of all for creating Dart.</para> | 794 and most of all for creating Dart.</para> |
720 </sect1> | 795 </sect1> |
721 </preface> | 796 </preface> |
OLD | NEW |