Re: [PHP-DEV] Tweaks to memory_get_usage() and memory_get_peak_usage()

2015-04-27 Thread Dmitry Stogov
Hi Kalle, I don't think we should support all possible use cases introducing new C functions and modifiers. Users already have ability to get all the necessary information, and they may wrap memory_get_udage() as they like. Thanks. Dmitry. On Mon, Apr 27, 2015 at 10:26 AM, Kalle Sommer Nielsen

[PHP-DEV] Add support $object::class

2015-04-27 Thread S.A.N
Now this code causes an error PHP 5-7. PHP Parse: Syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' Do not want to use get_class($object) Thank. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] Tweaks to memory_get_usage() and memory_get_peak_usage()

2015-04-27 Thread Nikita Popov
On Mon, Apr 27, 2015 at 9:26 AM, Kalle Sommer Nielsen ka...@php.net wrote: Howdy After working with a couple of projects, I found it a little annoying that I would have to call memory_get_usage() twice first for emalloc()'d memory and after again for real memory, so I made a small patch

Re: [PHP-DEV] Re: [RFC] Reserving More Types in PHP 7

2015-04-27 Thread Johannes Schlüter
Hi, On Mon, 2015-04-27 at 09:50 -0600, Levi Morrison wrote: This was known at voting time, yes. and I hope voters understand what they are doing while voting and hope they considered that. As long as we have this voting scheme we have to follow the results else it's pointless. The number of

Re: [PHP-DEV] Add support $object::class

2015-04-27 Thread Marco Pivetta
On 27 April 2015 at 19:39, Rowan Collins rowan.coll...@gmail.com wrote: Marco Pivetta wrote on 27/04/2015 18:25: On 27 April 2015 at 16:35, Anthony Ferrara ircmax...@gmail.com wrote: On Mon, Apr 27, 2015 at 7:18 AM, S.A.N ua.san.a...@gmail.com wrote: Now this code causes an error PHP 5-7.

[PHP-DEV] Resolution of static variables in the function scope not using forwarded calling information?

2015-04-27 Thread php
Hello all, I ran into some very strange behavior while experimenting with static function variables. It looks like a bug to me, but I couldn't find any previous reports or discussions about the subject, so I wanted to gather your input before submitting it as such. Static variables in the

Re: [PHP-DEV] Re: [RFC] Reserving More Types in PHP 7

2015-04-27 Thread Benjamin Eberlei
On Mon, Apr 27, 2015 at 6:44 AM, Stanislav Malyshev smalys...@gmail.com wrote: Hi! Well, it looks to me like all the discussion is around preventing class and namespace names like “string”, “float”, etc. Granted, PHP class names are case-insensitive, but how hard would it be to reserve

Re: [PHP-DEV] Re: [RFC] Reserving More Types in PHP 7

2015-04-27 Thread Matteo Beccati
On 27/04/2015 10:15, Benjamin Eberlei wrote: It should be possible to write something with PHP Parser detecting all the occurances of String/string class usage to at least give a worklog of entries that need to be changed, or maybe generate a patch file that can be applied to the code base after

[PHP-DEV] Tweaks to memory_get_usage() and memory_get_peak_usage()

2015-04-27 Thread Kalle Sommer Nielsen
Howdy After working with a couple of projects, I found it a little annoying that I would have to call memory_get_usage() twice first for emalloc()'d memory and after again for real memory, so I made a small patch that allows retrieving both values in a single call[1]. The patch itself is rather

Re: [PHP-DEV] Re: [RFC] Reserving More Types in PHP 7

2015-04-27 Thread Lester Caine
On 27/04/15 09:15, Benjamin Eberlei wrote: There was a lot of discussion about this topic. Right now, unless there's a proposal to fix it that works, I don't see what can be done about it. It should be possible to write something with PHP Parser detecting all the occurances of

Re: [PHP-DEV] Re: [RFC] Reserving More Types in PHP 7

2015-04-27 Thread Rowan Collins
On 26 April 2015 20:36:12 GMT+01:00, Nate Abele nate.ab...@gmail.com wrote: Lithium, CakePHP, and Drupal all have String classes. I gather that Drupal's String class was actually a rather badly designed utility class, and its methods have been rehomed in more specific areas. AFAICS, it was only

Re: [PHP-DEV] [RFC] Reserving More Types in PHP 7

2015-04-27 Thread Bryan Crowe
CakePHP has renamed its String class to Text and it was simple as this for us to be ready for PHP 7: https://github.com/cakephp/cakephp/blob/9ba845ef831c7f92519e5b233e294deeb0b2b53f/config/bootstrap.php#L21-L23

Re: [PHP-DEV] Re: [RFC] Reserving More Types in PHP 7

2015-04-27 Thread Larry Garfield
On 04/27/2015 06:06 PM, Rowan Collins wrote: On 26 April 2015 20:36:12 GMT+01:00, Nate Abele nate.ab...@gmail.com wrote: Lithium, CakePHP, and Drupal all have String classes. I gather that Drupal's String class was actually a rather badly designed utility class, and its methods have been

Re: [PHP-DEV] Resolution of static variables in the function scope not using forwarded calling information?

2015-04-27 Thread Levi Morrison
On Mon, Apr 27, 2015 at 3:12 PM, p...@lvl.fastmail.com wrote: Hello all, I ran into some very strange behavior while experimenting with static function variables. It looks like a bug to me, but I couldn't find any previous reports or discussions about the subject, so I wanted to gather your

Re: [PHP-DEV] Add support $object::class

2015-04-27 Thread Anthony Ferrara
On Mon, Apr 27, 2015 at 7:18 AM, S.A.N ua.san.a...@gmail.com wrote: Now this code causes an error PHP 5-7. PHP Parse: Syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' Do not want to use get_class($object) Why not?

[PHP-DEV] Re: [RFC] Reserving More Types in PHP 7

2015-04-27 Thread Levi Morrison
On Sun, Apr 26, 2015 at 1:36 PM, Nate Abele nate.ab...@gmail.com wrote: On Sunday, April 26, 2015, Levi Morrison le...@php.net wrote: On Sat, Apr 25, 2015 at 8:27 PM, Nate Abele nate.ab...@gmail.com wrote: Dear Internals, I would like to discuss a small RFC for reserving more types in PHP 7:

Re: [PHP-DEV] Add support $object::class

2015-04-27 Thread Marco Pivetta
On 27 April 2015 at 16:35, Anthony Ferrara ircmax...@gmail.com wrote: On Mon, Apr 27, 2015 at 7:18 AM, S.A.N ua.san.a...@gmail.com wrote: Now this code causes an error PHP 5-7. PHP Parse: Syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable

Re: [PHP-DEV] Add support $object::class

2015-04-27 Thread S.A.N
Why not? Seriously, why not? ::class was added because there was no easy way to get from the symbol class name to the string representation of it (you couldn't pass it to a function, etc since it would look like a constant). So ::class is a purely compile time construct to turn a literal

Re: [PHP-DEV] Add support $object::class

2015-04-27 Thread S.A.N
2015-04-27 20:33 GMT+03:00 Nicolas Grekas nicolas.gre...@gmail.com: Systems that depend on `get_class()` a lot would An for non-objects types, I suggest that $var::class could return the same as get_type($var). That would allow saving ref mismatches when $var is a ref. +1 -- PHP Internals

Re: [PHP-DEV] Add support $object::class

2015-04-27 Thread Nicolas Grekas
Systems that depend on `get_class()` a lot would An for non-objects types, I suggest that $var::class could return the same as get_type($var). That would allow saving ref mismatches when $var is a ref.

Re: [PHP-DEV] Add support $object::class

2015-04-27 Thread Rowan Collins
Marco Pivetta wrote on 27/04/2015 18:25: On 27 April 2015 at 16:35, Anthony Ferrara ircmax...@gmail.com wrote: On Mon, Apr 27, 2015 at 7:18 AM, S.A.N ua.san.a...@gmail.com wrote: Now this code causes an error PHP 5-7. PHP Parse: Syntax error, unexpected 'class' (T_CLASS), expecting

Re: [PHP-DEV] Closure::call() to access private data, really ?

2015-04-27 Thread Stanislav Malyshev
Hi! Perhaps the best thing to do is to forbid rebinding a Closure to an internal class ? So I have checked into this further, and the good news is that we don't have too many internal classes that declare private/protected properties. Actually, the only one where you could mess stuff up was

Re: [PHP-DEV] Add support $object::class

2015-04-27 Thread Stanislav Malyshev
Hi! 1. get_class($object) - looks bad and long There's nothing bad in calling functions. Functions are part of PHP and are completely OK. 2. Illogically - Bar::class valid syntax, $object::class invalid syntax. 3. Function call get_class($object) is slower Unless you code is doing get_class