Closed GoogleCodeExporter closed 9 years ago
Revision e219281b0f19 fixed the known members mod. Setting a view should be
done by:
addView($home) {
$home->addView(array('known_members','view'),"known_members::view");}
event::register still accepts both ways, converting internally. I updated the
documentation to make it clearer that array(class, method) is preferred.
Accepting both seems confusing but we can break that in a future release. :)
Original comment by kovellia
on 17 Dec 2011 at 3:07
Isn't the core problem that:
1. class::static_member sometimes works
2. array( 'class', 'static_member' ) always works
and
3. array( 'class', 'instance_member' ) always works
?
Shouldn't you just disable the static syntax, perhaps just deconstructing it
inside of addView?
function addView( $wang, $chung ) { // psuedocode
$array_out = $wang;
if ( preg_match( '/::/', $wang ) > 0 ) {
$array_out = preg_split( '/::/', $wang )
}
call_user_fun_array( $array_out, $chung );
}
v0v mountains and molehills. I'm just going to move on.
Original comment by jjl...@gmail.com
on 19 Dec 2011 at 1:54
Working around all the various ways PHP will let you run code leads to madness.
You are quite right that that would work, but when you add code to allow for
all the various combinations possible, things get unwieldy and hard to follow.
My hope is that by changing the demonstration code in known members, people
will follow either the demo code, or the php documentation, either of which
will give the 'correct' approach. (This may also lead to madness but it's a
monsters under the bed sort rather than a Cthulhu shaking you awake madness.)
I may be biased, having just read the involved party code for doing things like
adding alliances to a killlist. It takes an integer, an array of integers, an
object with a getID() method, or an array of such objects. It works just fine,
but the code overall would be easier to follow if there was only one method, or
at most if it allowed either integer or array of integers.
I add in tangled mess of exceptions when I have to, but I'm hoping I don't have
to here. We've gone a few years without problems so hope is viable.
Original comment by kovellia
on 19 Dec 2011 at 2:13
Original issue reported on code.google.com by
jjl...@gmail.com
on 16 Dec 2011 at 3:24