RE: [PHP-DEV] [RFC] Constant Scalar Expressions

2013-08-13 Thread Patrick Schaaf
Would this allow using constants, too? Class constants? const FOO = 1; const BAR = self::FOO + 1; const BAZ = self::FOO + 2; const BARF = GLOBAL_BARF; const IMPORT = otherclass::IMPORT; // with autoloading? In my opinion these would start to make the feature useful. Even more useful, but probabl

RE: [PHP-DEV] [RFC] Constant Scalar Expressions

2013-08-13 Thread Sebastian Krebs
Am 14.08.2013 08:17 schrieb "Christian Stoller" : > > > Hello all, > > > > I'd like to propose a new RFC for 5.NEXT: > > > > https://wiki.php.net/rfc/const_scalar_expressions > > > > This allows for defining constant expressions which are resolved at compile > > time. > > What should that be for? >

RE: [PHP-DEV] [RFC] Constant Scalar Expressions

2013-08-13 Thread Christian Stoller
> Hello all, > > I'd like to propose a new RFC for 5.NEXT: > > https://wiki.php.net/rfc/const_scalar_expressions > > This allows for defining constant expressions which are resolved at compile > time. What should that be for? > const FOO = 1 + 1; > const BAZ = "HELLO " . "WORLD!"; Why not just w

[PHP-DEV] [RFC] Constant Scalar Expressions

2013-08-13 Thread Anthony Ferrara
Hello all, I'd like to propose a new RFC for 5.NEXT: https://wiki.php.net/rfc/const_scalar_expressions This allows for defining constant expressions which are resolved at compile time. for example: const FOO = 1 + 1; static $bar = 1 << 2; function foo($a = 1 | 2) {} class foo { public $bar

[PHP-DEV] array_unique() and object comparison

2013-08-13 Thread Matthieu Napoli
array_unique() is perfect for removing duplicates in a string array, but not so great for an array of objects. SORT_REGULAR was added to compare items without casting them to string. However it uses the "==" comparison operator. I see two improvements: - on a short term, improve the document