Hi David, let's drop any distinction between "entry not found" and "dependency > missing". We don't need this because users of containers can anyway figure > that out. >
I'd like to propose the opposite alternative. That's no a rebuttal of yours and I sincerely thank you for being so open to comments. Let's see: My naïve question was "doesn't that concept [NotFoundExceptionInterface] duplicate the "has()" method?" Your new proposal is to answer a strict "no" to this question, thus remove the exception all together. What about answering it with a strict "yes"? What I mean is to keep NotFoundExceptionInterface and define it a to be thrown by "get" only and only if would have returned false. I think that would fix Larry's comments, and more importantly, fix any ambiguity and the semantic of this exception. So, to sum up, error handling in PSR11 could look like: - "has" never throws anything but instanceof \Error - it only returns true/false - "get" throws NotFoundExceptionInterface whenever "has" would have returned false - it "directly" throws ContainerExceptionInterface - and is allowed to let anything else bubble if thrown by the factories/initializers it calls. > It also enforces best practices as users that want to check if an entry > exists will use has instead of NotFoundExceptionInterface (the exception > can no more be used for control flow) > This is the main difference with your proposal: NotFoundExceptionInterface could be used for flow control. But since doing so would be strictly equivalent to call "has", we could even add in the PSR a SHOULD NOT - if worth it. Does it make sense? Nicolas -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAOWwgpmQZnbvCfLkE58mDhBT3NHCWqdkPabPEsJRkezTHZm-AQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
