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

2015-05-07 Thread Ralph Schindler
2. Illogically - Bar::class valid syntax, $object::class invalid syntax. I'll grant you the consistency argument. I'm all for consistency, but that's the ONLY valid reason you've stated. Even then I think this part of the argument is fairly weak. In Bar::class, the context of Bar is

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

2015-05-07 Thread Marco Pivetta
On 7 May 2015 at 16:04, Ralph Schindler ra...@ralphschindler.com wrote: 2. Illogically - Bar::class valid syntax, $object::class invalid syntax. I'll grant you the consistency argument. I'm all for consistency, but that's the ONLY valid reason you've stated. Even then I think this part

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

2015-05-07 Thread S.A.N
$object is not guaranteed to be an object, it could be anything (int, string, etc) or nothing (null). using ::class for a variable, I'd argue, makes for less consistency. What would the replacement be for non-object variables? An error, exception, or false, or string type? At least in

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

2015-04-30 Thread Sara Golemon
On Mon, Apr 27, 2015 at 10:28 AM, S.A.N ua.san.a...@gmail.com wrote: Why not? 1. get_class($object) - looks bad and long It's a function call. A pretty much self-declarative one at that. What is bad about it? For that matter, what's long about it? It's pretty short as PHP function calls go.

[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] 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.

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?

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] 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