NYCPHP Meetup

NYPHP.org

[nycphp-talk] multiple constructors

George Schlossnagle george at omniti.com
Wed Sep 29 22:17:11 EDT 2004


On Sep 29, 2004, at 10:09 PM, Matthew Terenzio wrote:

>> Or just use func_get_args()
>
> I see, that will work for me George.
>
> Would you agree that if it is an object or a certain "typed" parameter 
> you expect, you should explicitly show what the constructor is 
> expecting. I mean for the sake of a future programmer using  the 
> class.?

It's certainly one of the nice aspects of php5's typehints support.  Of 
course, most other scripting languages don't support typehinting at all 
(Python, Perl, etc.), so it's not like you are losing something you 
might have if you move to a peer-language.  Unfortunately true 
multimethod dispatch would be slow as molasses in PHP, which is the 
primary excuse/reasoning for it not being implemented.

George




More information about the talk mailing list