Hi!

> On 1 Dec 2014, at 15:27, guilhermebla...@gmail.com wrote:
> 
> Hi Andrea,
> 
> Thanks a lot for putting efforts thinking through this problem.
> Indeed we have 3 problems that leads to "static classes". You detailed 2 of 
> them.
> The third is around encapsulation. I may want functions that are reused by 
> other functions at the namespace level, but that shouldn't be used outside of 
> it. By purely supporting (1), you still didn't address this issue. That would 
> be easily addressed by having private static functions inside of the static 
> class.

Hmm. Well, having functions not to be used outside of the namespace/file isn’t 
a problem unique to classes. That would be useful for people writing normal 
functions. Having something like static functions would be great.

> So, as you walk through your options, didn't it feel wrong to you? Static 
> classes are an easy addiction to the language and would have a negligent 
> performance impact, since it just adds 2 conditions in zend_vm and zend_api.

Yes, they’re a simple addition, but I still think they’re the wrong solution to 
the problem. We shouldn’t force people to use classes for simple collections of 
functions. People have wanted function autoloading for years. I say it’s high 
time we add that.

Thanks!
--
Andrea Faulds
http://ajf.me/





--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to