Date: Wed, 8 Jun 2022 14:36:00 -0400
Em qua., 8 de jun. de 2022 às 13:23, Nathan Sidwell via SG15
<sg15_at_[hidden]> escreveu:
> Q1) Is there a use case for implementation partitions (a non-interface
> partition) that are not imported in any module unit? How would that
> differ from a regular implementation partition?
The term "implementation partition" is a bit confusing, because it
communicates it's close to what "implementation unit" is. We've
settled on using "internal partition" instead, as that more clearly
communicates what it does.
> I don't think we require implementation partitions
> be imported at least once in a program.
If a tree falls in a forest and no one is around to hear it, does it
make a sound?
You're not required to import in any *specific* unit, but if you don't
import anywhere, then nothing can see it.
The flexibility here is that you can have internal partitions that are
not reachable by the interface and therefore don't need to be
distributed with the interface. But for them to be useful, they still
need to be reachable by something (presumably the implementation
unit).
> However, Q1 raises the possibility that an implementation partition may
> not be imported anywhere, so its global initializer fn is never called
> from another global init
I think this is already the case with global initializers in objects
that end up not being linked from an archive, so I don't think it's
without precedent to just accept that if you never import a module, it
is just not going to be linked in any meaningful way.
daniel
<sg15_at_[hidden]> escreveu:
> Q1) Is there a use case for implementation partitions (a non-interface
> partition) that are not imported in any module unit? How would that
> differ from a regular implementation partition?
The term "implementation partition" is a bit confusing, because it
communicates it's close to what "implementation unit" is. We've
settled on using "internal partition" instead, as that more clearly
communicates what it does.
> I don't think we require implementation partitions
> be imported at least once in a program.
If a tree falls in a forest and no one is around to hear it, does it
make a sound?
You're not required to import in any *specific* unit, but if you don't
import anywhere, then nothing can see it.
The flexibility here is that you can have internal partitions that are
not reachable by the interface and therefore don't need to be
distributed with the interface. But for them to be useful, they still
need to be reachable by something (presumably the implementation
unit).
> However, Q1 raises the possibility that an implementation partition may
> not be imported anywhere, so its global initializer fn is never called
> from another global init
I think this is already the case with global initializers in objects
that end up not being linked from an archive, so I don't think it's
without precedent to just accept that if you never import a module, it
is just not going to be linked in any meaningful way.
daniel
Received on 2022-06-08 18:36:12