Open cedvdb opened 7 months ago
Not sure what "only accessible inside the nodule" means for a declaration in a _a.dart
file.
If we simply make it an error to import a file starting with _
from another nodule, then that's directly inaccessible.
If another library in the same module exports the declaration, then it shouldn't matter where that name comes from.
We should either disallow exporting such libraries, or accept that it's possible.
I expect a use for module private libraries to be declaring functions intended to be module private and public together in one library, so they can access the library private names of ready other, and only exporting the public ones.
Or we could just make importing a library starting with _
, or from a directory starting with _
, frowned upon, like importing from inside src/
. No strong protection, so if modules need that, it's not enough.
In the module feature spec privacy is achieved by using
_
like you would for a library and it's extended to module.I would like to keep some level of library privacy, that is I want
A._b
not to be accessible fromC
, despite both being in the same module, when those are declared in different files. Since it seems like adding aprivate
/#
access modifier is not on the table (or is it ?), I'm proposing using the file name instead for module privacy.Such that:
A._b
=>_b
is library private, not accessible by the whole moduleA.b
=>b
is public, accessible by the whole module_a.dart
, a is only accessible inside the modulea.dart
, a is public