[PEPr] Comment on PHP::Assert
| From: | Carsten Lucke | Date: | Thu, 11 Aug 2005 13:56:01 +0000 |
| Subject: | [PEPr] Comment on PHP::Assert | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-39325@lists.php.net to get a copy of this message | ||
Carsten Lucke (http://pear.php.net/user/luckec) has commented on the proposal for PHP::Assert.
Comment:
Jesper, in some way you're right. Assertions aren't a big thing but IMO
code like:
PHP_Assertion::check($statementThatHasToBeTrue);
is much easier to read than:
if ((!$statementThatHasToBeTrue) && ($doAssert)) { throw new
SomeException(); }
Another thing is that assertions are mostly use in cases where you want to
make sure that something that normally could never happen really doesn't.
In my code example you make this clear by using PHP_Assertion::foo(), but
in your case that is not that obvious.
And no one is forced to use assertions just becvause there is a package in
PEAR for that purpose. :-)
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=285
--
Sent by PEPr, the automatic proposal system at http://pear.php.net