Site-www: 'Create Library Packages' page doesn't describe `library` and `part`

Created on 13 Dec 2018  路  3Comments  路  Source: dart-lang/site-www

Page URL: https://www.dartlang.org/guides/libraries/create-library-packages
Page source: https://github.com/dart-lang/site-www/tree/master/src/_guides/libraries/create-library-packages.md

Description:
https://www.dartlang.org/guides/language/language-tour#implementing-libraries has:

See Create Library Packages for advice on how to implement a library package, including:

  • How to organize library source code.
  • How to use the export directive.
  • When to use the part directive.
  • When to use the library directive

However, the linked "Create Library Packages" page doesn't explain the library or part directives at all. It only has notes such as:

Note: When the library directive isn鈥檛 specified, a unique tag is generated for each library based on its path and filename. Therefore, we suggest that you omit the library directive from your code unless you plan to generate library-level documentation.

Note: You may have heard of the part directive, which allows you to split a library into multiple Dart files. We recommend that you avoid using part and create mini libraries instead.

Note: To include any library-level documentation in the generated docs, you must specify the library directive. See issue 1082.

None of these explain what library and part do nor provide any examples for how to use them.

While their usage might be discouraged, they're still part of the language, and it would be nice to document somewhere what they are and what they do.

e2-days p2-medium

Most helpful comment

Every Dart app is a library

is perhaps the most confusing and misleading sentence in all of our docs.

All 3 comments

I'll also add that a lot of Dart documentation (e.g. the "Libraries and visibility" section of the Language Tour talks about "libraries" and mentions that identifiers with a leading _ are private to the library, but it doesn't explain what a library is (other than "Every Dart app is a library", but that raises more questions). Is a library normally a single .dart file? The directory?

Every Dart app is a library

is perhaps the most confusing and misleading sentence in all of our docs.

I cannot find documentation anywhere about what the library name is used for. The library is imported using its file name (not the library name). It looks like it is used for resolving deferred imports. What else? This should be documented!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarahec picture sarahec  路  3Comments

kwalrath picture kwalrath  路  4Comments

ug2454 picture ug2454  路  4Comments

farr64 picture farr64  路  3Comments

rahul-bavaliya picture rahul-bavaliya  路  3Comments