Re: Consistent function names
| From: | Yasuo Ohgaki | Date: | Mon, 02 Mar 2015 21:39:32 +0000 |
| Subject: | Re: Consistent function names | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-84188@lists.php.net to get a copy of this message | ||
Hi Markus,
On Mon, Mar 2, 2015 at 4:47 PM, Markus Fischer <markus@fischer.name> wrote:
> On 01.03.15 21:19, Yasuo Ohgaki wrote:
> >>> The answer is no, it's just not worth it. Having a function called
> >> str_pos which is an alias of strpos, but only on some versions, is more
> >> confusing, not less.
> >>
> >> My sentiment too. Factor in that someone already using the proposed
> >> himself, things can only go south from here.
> >>
> >> If PHP wants to clean up, then do it right: use a namespace for it.
> >
> >
> > I agree use of namespace is better solution. It's rather severe BC,
> though.
> > How about rename functions except "string" and "array" related
> > functions
> ?
> >
> > BTW, I cannot change document system, but I'm going to update all doc
> > contents if this passes.
>
> I'm not sure we're on the same page. I'm talking about moving in
> "no-BC-break" way, if at all. That is, no existing function be touched.
>
I would love to have namespace that could be imported like
namespace \php\7\function\* as \; // Import all functions to \
namespace \php\7\function\* as \;
and have INI like
default_namespaces "\php\7\function\* \php\5\function\*"
This way, we'll have no-BC since user can select functions to import.
(Namespace layout should be improved. Above example will have issues
most certainly)
Your idea is similar to this, I guess.
>
> As to whether namespaces-aliases are really necessary I leave for others.
>
> I think a sensible thing to do at this stage would be, rather than
> changing existing stuff, laying the ground work how to do it in the
> future. What I mean is: an RFC for consistent introducing new "names" in
> the PHP language.
>
> So that /future/ functionality does not always get slapped into the
> global namespace but that we finally start using our reserved PHP\
> namespace and put stuff in there instead of the global pollution.
>
> Yeah, I think that direction is a sensible start and gather peoples
> mindset about this instead of going backwards, renaming stuff without
> clear plan, etc.
We may postpone some renames.
I wrote almost complete list. Please take a look at
https://wiki.php.net/rfc/consistent_function_names#list_of_functions_to_be_renamed
There are many functions that can have aliases safely.
I'll post [RFC][DISCUSSION] now. Please comment on new thread!
Thank you.
--
Yasuo Ohgaki
yohgaki@ohgaki.net