PHP PHP.net news server web interface
From: Date: Mon Dec 16 16:27:32 2013
Subject: Re: Flexible function naming
References: 1 2 3 4  Groups: php.internals 
Ángel wrote:
> That's a horrible idea Robert, sorry.
>
> You would end up with dozens of different ways to call the same 
> function. Plus libraries incompatible without that option set. But I 
> will center in a much clearer problem: suppose you need to look up 
> where is somefunctiontocheckusername() called. Is it called as 
> 'somefunctiontocheckusername', 'some_function_to_check_username', 
> 'some_function_to_check_user_name', 'some_function_to_check_userName', 
> 'someFunctionToCheckUsername', 'someFunctionToCheckUserName', 
> 'SomeFunctionToCheckUsername', 'SOMEFUNCTIONTOCHECKUSERNAME', or maybe 
> 's_o_m_e_f_u_n_c_t_i_o_n_t_o_c_h_e_c_k_u_s_e_r_n_a_m_e' ?
As i wrote before, this proposal mainly is thought for application teams 
to make consistency possible. In order to make it work for libraries, it 
would need to be extended. If you provide a library, you still would be 
stuck with the original name of the function unless you introduce a way 
to declare the referral style.

If you look at the core PHP functions (e.g. array) and some important 
new additions like DateTime, you will see that there is mainly two 
styles competing: Underscore and Camelcase, so in most cases it will be 
one synonym, sometimes two, but never what you were enumerating.

> If you really want to rename core functions in your own system, you 
> can do it with runkit... But remember runkit motto: «For all those 
> things you.... probably shouldn't have been doing anyway....»

Thanks, i will look into that.

Robert


« previous php.internals (#70679) next »

Written by Jim Winstead. no rights reserved. (source code)