Skip to content

Make {@canonicalFor library_name.DeclName} not use library name. #4257

Description

@lrhn

The canonicalFor directive is possibly the last part of the Dart SDK that relies on giving a library a name. Everything else has at least a different alternative for unnamed libraries.

There is no other reason to give a library a name, and using library names is generally considered "so last decade!", so it irks when you have to go write a library name just to use canonicalFor.

The canonicalFor directive should introduce a different way to refer to a library.

I'd recommend:

  • {@canonicalFor DeclName}, where DeclName denotes the declaration actually exported by this library by that name. That should be unique and always what you want.
  • {@canonicalFor package:whatnot/entry.dart DeclName} or * {@canonicalFor package:whatnot/entry.dart#DeclName} if you want to denote the library. URIs is how you denote a library. But really shouldn't be necessary, the first option should always be the right one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions