Markus Fischer schrieb:
$foo->bar( (int)$baz, (string)$sober, (bool)$result['column_checkbox'] );
but this means he is really forced to think what he is really passing.
I'm surprised that you find this desirable.
It will not raise the overall code quality in a major way, but it helps
developers on both sides (devs of libraries, devs of using the
libraries) to ensure proper passing of varaibles.
It is optional. And it will likely be only used by
library/framework/component/whatever. But for them, I think, it's a win.
As explained before I consider a good framework to take work *off* of
me, not make me think about details like whether
$result['column_checkbox'] is 0, false or null to signify "option not
checked". Why should I care? Typos in your parameters should be detected
by testing (or something we've been thinking to implement as a PHP patch
for a while but haven't gotten around yet: a warning about variables
which are only used once).
I would even go one step further and compare this approach to the UAC in
Windows Vista: It is annoying and at the same time teaches users to
ignore warnings by simply "clicking Ok" (casting) because 99% of the
time that's the right thing to do anyway.
A framework is written once but (hopefully) used any times. Why not make
the framework robust enough to spare those details from its users? I'm
tempted to call this approach unPHPonic (-:C
Ok, my horse is officially dead now ;-)
- Chris
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php