container-interop/container-interop — pull request #8 by moufmouf (2013-12-21 17:08:26+00:00)
Title: Proposing ParentAwareContainerInterface

Following the discussion on the FIG mailing list with Stephan Hochdörfer (https://groups.google.com/forum/#!topic/php-fig/GMiHt5BGmUs), I would like to propose the addition of a new interface that would enable a container to support a "fallback" mechanism if it does not contain a requested entry.

This kind of behaviour is needed if we want containers to fully interact with each others.

Let's take a sample: the Acclimate's [CompositeContainer](https://github.com/jeremeamia/acclimate-container#composite-container) can create a container aggregating several containers. But inside each container, you cannot reference the entries of other containers.

However, if containers contained by `CompositeContainer` were implementing the `ParentAwareContainerInterface`, all instances may declare the `CompositeContainer` as a parent container. This way, if the configuration of a container references an instance not declared in this container, the container can request the other containers for the missing entry.

I think there is some thinking to be done regarding the name of the interface. I called it `ParentAwareContainerInterface`, which carries the idea that there might be a container on top of the current container.
Other names might carry other ideas. For instance: `ChainableContainerInterface` carries the idea there is a chain of containers. However in the example above, we are referencing the `CompositeContainer`, so this is not really a chain (in a chain, each container should reference the next one in the chain). `FallbackContainerInterface` is also an interesting name that I like pretty much.

Any idea regarding this interface, and regarding the name of this interface?

Also, since the main `ReadableContrinerInterface` is not ready yet, we might want to put this interface in a separate branch for the time being.

What do you think?