Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-18 Thread Ferenc Kovacs
On Thu, Aug 18, 2011 at 7:19 PM, Stas Malyshev wrote: > Hi! > > On 8/17/11 3:15 PM, Sebastian Krebs wrote: >> >> However, in my opinion the important part is to just make a decision the >> sooner, the better, as long as there are not too much creepy code out >> there (I don't know any and I can't

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-18 Thread Stas Malyshev
Hi! On 8/17/11 3:15 PM, Sebastian Krebs wrote: However, in my opinion the important part is to just make a decision the sooner, the better, as long as there are not too much creepy code out there (I don't know any and I can't imagine, that there is). Because functions with namespace are quite un

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-18 Thread Michael Morris
I'm not so sure about that. For example, class PDO is PHP core. Suppose I create A\PDO. When PHP is asked for A\PDO and fails to find it then it will die. Correct me if I'm wrong but I think it does NOT go looking for \PDO. Another bugbear is classes will most likely be 1 class = 1 file. Funct

RE: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-17 Thread John Crenshaw
> -Original Message- > From: Stas Malyshev [mailto:smalys...@sugarcrm.com] > Sent: Wednesday, August 17, 2011 7:37 PM > To: Matthew Weier O'Phinney > Cc: internals@lists.php.net > Subject: Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload* > &g

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-17 Thread Stas Malyshev
Hi! On 8/17/11 2:44 PM, Matthew Weier O'Phinney wrote: There's nothing saying you can't have the exact same situation right now with classes and autoloading, too. Well, there is something - the "file per class" custom which is followed quite widely. And also classes don't have fallbacks, wh

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-17 Thread Etienne Kneuss
Hi, On Thu, Aug 18, 2011 at 00:15, Sebastian Krebs wrote: > Hi, > > With this mail I don't want to talk to anyone directly, but I just want to > summarize the situation as far as I understand. > > > --- > - Autoloading constants > --- > No problem here: When the loading procedure fails, it gets c

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-17 Thread Sebastian Krebs
Hi, With this mail I don't want to talk to anyone directly, but I just want to summarize the situation as far as I understand. --- - Autoloading constants --- No problem here: When the loading procedure fails, it gets converted to a string like before. It may be a performance impact, but the

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-17 Thread Matthew Weier O'Phinney
On 2011-08-17, Michael Morris wrote: > --001636833a84f3029304aab9fd15 > Content-Type: text/plain; charset=ISO-8859-1 > > This member of the peanut gallery would like to point out the following > danger. Consider the following function collection for namespace A. > > namespace A; > function strp

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-17 Thread Michael Morris
This member of the peanut gallery would like to point out the following danger. Consider the following function collection for namespace A. namespace A; function strpos() {} function myfunc() {} Now if I understand the RFC correctly there's an unintuitive problem as follows - if myfunc is ca

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-15 Thread Chris Stockton
Hello Stas, On Mon, Aug 15, 2011 at 1:26 AM, Stas Malyshev wrote: > Hi! > It's not a shortcoming, it was designed that way, and for very serious > reasons. If you want to know the reasons, there were discussed extensively > when namespaces were discussed. Please re-read that discussion. And all >

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-15 Thread Chris Stockton
Hello, On Mon, Aug 15, 2011 at 2:30 PM, Matthew Weier O'Phinney wrote: > On 2011-08-14, Derick Rethans wrote: >> On Sat, 6 Aug 2011, Ferenc Kovacs wrote: >> > I would like to introduce this RFC which would provide function >> > autoloading through the spl_autoload facility without userland BC >>

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-15 Thread Matthew Weier O'Phinney
On 2011-08-14, Derick Rethans wrote: > On Sat, 6 Aug 2011, Ferenc Kovacs wrote: > > I would like to introduce this RFC which would provide function > > autoloading through the spl_autoload facility without userland BC > > breakage. > > > > https://wiki.php.net/rfc/autofunc > > I understand the pr

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload

2011-08-15 Thread Rasmus Schultz
I'm not talking about the __call() magic method, I'm proposing a global and/or namespaced call to a flat __call() *function *- you could use it to implement autoloading like so: * * closure) and loading scripts that return an anonymous function. Similarly, we could use a namespace-specific __call

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-15 Thread Ferenc Kovacs
On Mon, Aug 15, 2011 at 10:26 AM, Stas Malyshev wrote: > Hi! > > On 8/15/11 12:54 AM, Ferenc Kovacs wrote: >> >> I know that the bad decisions in the past won't count in this >> argument, but the current "namespace resolution falls back to the >> global namespace" is the one to blame for this shor

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-15 Thread Stas Malyshev
Hi! On 8/15/11 12:54 AM, Ferenc Kovacs wrote: I know that the bad decisions in the past won't count in this argument, but the current "namespace resolution falls back to the global namespace" is the one to blame for this shortcoming. It's not a shortcoming, it was designed that way, and for ve

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-15 Thread Ferenc Kovacs
On Mon, Aug 15, 2011 at 9:15 AM, Sebastian Krebs wrote: > 2011/8/15 Stas Malyshev > >> Hi! >> >> >> On 8/14/11 11:21 PM, Sebastian Krebs wrote: >> >>> I already made an suggestion [1], that bypass this. >>> >> >> That suggestion means you can not autoload namespaced function that >> overrides glo

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-15 Thread Sebastian Krebs
2011/8/15 Stas Malyshev > Hi! > > > On 8/14/11 11:21 PM, Sebastian Krebs wrote: > >> I already made an suggestion [1], that bypass this. >> > > That suggestion means you can not autoload namespaced function that > overrides global function. Major WTF. Imo overriding built-in functions is a WTF.

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-15 Thread Stas Malyshev
Hi! On 8/15/11 12:15 AM, Sebastian Krebs wrote: Imo overriding built-in functions is a WTF... Confusing others by changing the behaviour of well-known functions just sounds scary. So you want also to change namespace semantics... However, when you really want to do this, than you can load yo

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-15 Thread Herman Radtke
>> I already made an suggestion [1], that bypass this. > > That suggestion means you can not autoload namespaced function that > overrides global function. Major WTF. Also leads to two autoload calls (one > most probably resulting in exhaustive include path search) when autoloading > a non-namespac

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Stas Malyshev
Hi! On 8/14/11 11:21 PM, Sebastian Krebs wrote: I already made an suggestion [1], that bypass this. That suggestion means you can not autoload namespaced function that overrides global function. Major WTF. Also leads to two autoload calls (one most probably resulting in exhaustive include pa

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Sebastian Krebs
Hi, 2011/8/15 Stas Malyshev > Hi! > > > On 8/14/11 9:35 PM, Sebastian Krebs wrote: > >> Now I'm getting a little bit confused: About which new/changing >> semantics you are talking about? I want to use custom functions, that >> exists, since the language itself exists, but I want to get rid of >

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Stas Malyshev
Hi! On 8/14/11 9:35 PM, Sebastian Krebs wrote: Now I'm getting a little bit confused: About which new/changing semantics you are talking about? I want to use custom functions, that exists, since the language itself exists, but I want to get rid of unnecessary `[include|require]_once()`-calls.

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Sebastian Krebs
Hi, Am 15.08.2011 02:37, schrieb Stas Malyshev: Hi! On 8/14/11 2:50 PM, Sebastian Krebs wrote: I just want to use functions. Whats wrong with that? Really: Thats all. Nothing at all. But changing semantics of the language because somebody doesn't want to use existing semantics doesn't look l

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Stas Malyshev
Hi! On 8/14/11 2:50 PM, Sebastian Krebs wrote: I just want to use functions. Whats wrong with that? Really: Thats all. Nothing at all. But changing semantics of the language because somebody doesn't want to use existing semantics doesn't look like a good idea to me. PHP has means to do what

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload

2011-08-14 Thread Ferenc Kovacs
On Mon, Aug 15, 2011 at 12:11 AM, Rasmus Schultz wrote: > Instead of trying to figure out how to autoload functions and cover all your > bases, how about simply adding a __call() magic method? > > That way, each application (or framework) can make their own decisions about > what they're going to

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload

2011-08-14 Thread Rasmus Schultz
Instead of trying to figure out how to autoload functions and cover all your bases, how about simply adding a __call() magic method? That way, each application (or framework) can make their own decisions about what they're going to autoload and how. A much simpler solution, and one with more pote

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Sebastian Krebs
Hi, Am 14.08.2011 23:06, schrieb Stas Malyshev: Hi! On 8/14/11 1:39 PM, Sebastian Krebs wrote: Counterquestion: Why shouldn't I use functions? They exists, they are Because if you want to use functions of similar nature organized in a package, that's what classes are used for. When I must

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Stas Malyshev
Hi! On 8/14/11 1:39 PM, Sebastian Krebs wrote: Counterquestion: Why shouldn't I use functions? They exists, they are Because if you want to use functions of similar nature organized in a package, that's what classes are used for. You want to do something that goes contrary to how language is

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Sebastian Krebs
Hi, Am 14.08.2011 15:55, schrieb Derick Rethans: On Sat, 6 Aug 2011, Ferenc Kovacs wrote: I would like to introduce this RFC which would provide function autoloading through the spl_autoload facility without userland BC breakage. https://wiki.php.net/rfc/autofunc I understand the proposal,

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Sebastian Krebs
Hi, Am 14.08.2011 20:17, schrieb Stas Malyshev: Hi! On 8/14/11 7:02 AM, Nikita Popov wrote: As Sebastian already mentioned, if all functions in a namespace are grouped into one file, it would be simple to load that file using such a concept. Why wouldn't you just use a class? Counterquesti

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Stas Malyshev
Hi! On 8/14/11 7:02 AM, Nikita Popov wrote: As Sebastian already mentioned, if all functions in a namespace are grouped into one file, it would be simple to load that file using such a concept. Why wouldn't you just use a class? -- Stanislav Malyshev, Software Architect SugarCRM: http://www.su

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Nikita Popov
On Sun, Aug 14, 2011 at 3:55 PM, Derick Rethans wrote: > I understand the proposal, but I don't see any compelling reasons in the > RFC of why we actually need autoloading for functions? For classes it > makes sense because there is almost always a class to file mapping. For > functions (and const

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Derick Rethans
On Sat, 6 Aug 2011, Ferenc Kovacs wrote: > I would like to introduce this RFC which would provide function > autoloading through the spl_autoload facility without userland BC > breakage. > > https://wiki.php.net/rfc/autofunc I understand the proposal, but I don't see any compelling reasons in th

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Ferenc Kovacs
On Fri, Aug 12, 2011 at 3:54 PM, Jan Dolecek wrote: > Someone said that it won't be that easy, because functions are > searched within a namespace first and when they don't exist there, > then are called from global namespace. > > Example: > namespace example; > echo substr('Test', 1, 1); > > Whe

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-14 Thread Sebastian Krebs
Am 12.08.2011 15:54, schrieb Jan Dolecek: Someone said that it won't be that easy, because functions are searched within a namespace first and when they don't exist there, then are called from global namespace. Example: Whats about "both"? - Does \ exists? - Does \ exists? Till here everyt

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-12 Thread Jan Dolecek
Someone said that it won't be that easy, because functions are searched within a namespace first and when they don't exist there, then are called from global namespace. Example: wrote: > On Fri, Aug 12, 2011 at 12:12 PM, Sebastian Krebs > wrote: >> Hi, >> >> 2011/8/12 Ferenc Kovacs >> >>> On Sa

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-12 Thread Ferenc Kovacs
On Fri, Aug 12, 2011 at 12:12 PM, Sebastian Krebs wrote: > Hi, > > 2011/8/12 Ferenc Kovacs > >> On Sat, Aug 6, 2011 at 2:24 PM, Ryan McCue wrote: >> > Ferenc Kovacs wrote: >> >> I would like to introduce this RFC which would provide function >> >> autoloading through the spl_autoload facility wi

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-12 Thread Sebastian Krebs
Hi, 2011/8/12 Ferenc Kovacs > On Sat, Aug 6, 2011 at 2:24 PM, Ryan McCue wrote: > > Ferenc Kovacs wrote: > >> I would like to introduce this RFC which would provide function > >> autoloading through the spl_autoload facility without userland BC > >> breakage. > > > > Shouldn't the default type

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-12 Thread Ferenc Kovacs
On Sat, Aug 6, 2011 at 2:24 PM, Ryan McCue wrote: > Ferenc Kovacs wrote: >> I would like to introduce this RFC which would provide function >> autoloading through the spl_autoload facility without userland BC >> breakage. > > Shouldn't the default type be T_CLASS|T_INTERFACE? > sorry for the late

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-06 Thread Sebastian Krebs
Hi. I really like to see this [1] and also I would like to see this in 5.4. I cannot C, thus I would appreciate, if someone can provide a patch. Additional I suggests to include constants (global/namespace, not the class constants) into the RFC too. [1] http://news.php.net/php.internals/

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-06 Thread Ryan McCue
Ferenc Kovacs wrote: > I would like to introduce this RFC which would provide function > autoloading through the spl_autoload facility without userland BC > breakage. Shouldn't the default type be T_CLASS|T_INTERFACE? -- Ryan McCue -- PHP Internals - PHP Runtime Develo

[PHP-DEV] [RFC] Function autoloading through spl_autoload*

2011-08-06 Thread Ferenc Kovacs
Hi. I would like to introduce this RFC which would provide function autoloading through the spl_autoload facility without userland BC breakage. https://wiki.php.net/rfc/autofunc -- Ferenc Kovács @Tyr43l - http://tyrael.hu -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe,