Re: Exceptions for method on non-object rather than fatal (desired feature?)

From: Date: Thu, 23 Feb 2012 14:28:03 +0000
Subject: Re: Exceptions for method on non-object rather than fatal (desired feature?)
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
And with the latter, you've reduced the amount of checks you have to do, by putting them in the proper places (if baby and mother objects inherit from the same class you've essentially got one check on null inside getMother(), not many spread out in client code). Also, the client code now only knows about the immediate surroundings - and should obviously know if getGrandmother() or getGrandmotherName() can throw exceptions. So as far as I'm concerned, the feature proposed just makes it a easier to couple your code more tightly. I'd rather the language discouranged that - or at least not encourage it. Regards Peter
The example is a simplified illustration of the case, it's not literally the reason I want to have an exception here. I will take my time to make this very clear in the RFC. -- Ralf Lang Linux Consultant / Developer Tel.: +49-170-6381563 Mail: [email protected] B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

Thread (18 messages)

« previous php.internals (#57974) next »