Bug #11567 Updated: True Dynamic Binding and Public/Private
| From: | rasmus@php.net | Date: | Wed, 20 Jun 2001 04:42:51 +0000 |
| Subject: | Bug #11567 Updated: True Dynamic Binding and Public/Private | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-57332@lists.php.net to get a copy of this message | ||
ID: 11567
Updated by: rasmus
Reported By: Mike.Eggleston@michaelsmacshack.com
Old-Status: Open
Status: Analyzed
Bug Type: Feature/Change Request
Operating system:
PHP Version: 4.0.5
Assigned To:
Comments:
I completely disagree with the concept of dynamic binding.
Calling different functions based on the number of arguments
is spaghetti code waiting to happen. PHP supports default
values for arguments which makes them optional. Your
would be much cleaner if written with defaulted x and y
arguments which you then check and if you have the default
value for x and/or y you would calculate the center value.
Or alternatively use func_num_args to see how many args were
passed. To me it is cleaner to collect the functionality for a function in a single function
instead of splitting it
out over multiple functions. Imagine trying to debug some
code and you end up looking at the wrong function just
because you counted 17 arguments instead of 18.
As for the public/private issue. Sure, from an OO purity
perspective it would be nice. But it is functionally irrelevant. ie. your code would not work any
better or
worse by having the public/private differentiation.
Previous Comments:
---------------------------------------------------------------------------
[2001-06-19 22:05:53] cynic@php.net
function drawMe()
{
if( 2 == func_num_args() ) {
doStuff( func_get_arg(0) , func_get_arg(1) ) ;
} else {
doStuff( $defaultX , $defaultY ) ;
}
}
private vars/methods would be good... :)
---------------------------------------------------------------------------
[2001-06-19 15:10:06] Mike.Eggleston@michaelsmacshack.com
Ok Folks. I am really happy with PHP thus far. However to make it a true Object Oriented Language
you absolutly need Dynamic binding. This would be such a huge boon for us developers who love to
work within classes. Such as:
// Inside the class Circle
function DrawMe() {
// Getting Ceter Coords..
DrawMe($centX, $centY);
}
function DrawMe($x, $y) {
// Draws the circle at $x, $y
}
// End of code demo
This kind of ability can be extremely huge, if you use it right. Also, it allows for developers to
make a module extremely flexiable and powerful.
Secondly, I think that we are missing public and private sections of the OOP world. In the above
example, I would have the functions public, and the data structures inside of it totally hidden (or
private) so the programmer who is using my include just has to deal with the interface, and
can't touch the actual data. That is strength and beauty of encapsulation.
I just thought you may want to hear this, and I am hoping to hear from you guys (and gals) that you
are hard at work to implement it and it is coming soon.
Thanks for reading my rant!!
Mike Eggleston
AmeriGroup
Mike.Eggleston@michaelsmacshack.com
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=11567&edit=2