RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) /zend_compile.c
| From: | Andi Gutmans | Date: | Fri, 18 Nov 2005 19:30:09 +0000 |
| Subject: | RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) /zend_compile.c | ||
| References: | 1 2 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-4364@lists.php.net to get a copy of this message | ||
At 11:51 PM 11/17/2005, Dmitry Stogov wrote:
I don't see any reason not allow null as default value for arguments with array type hint.It's not a valid array value.
In real OOP languages "array" just a special class.But we're not a real OOP language, we are PHP. Arrays are native types (and I hope they remain so), and I think it's cleaner to require people to write an empty array as the default value.
The situation before this patch was buggy. Compiler allowed (array $a = null), but executor emited error.Maybe we should fix the compiler? Andi
Thanks. Dmitry. -----Original Message----- From: Andi Gutmans [mailto:andi@zend.com] Sent: Friday, November 18, 2005 4:10 AM To: Derick Rethans; Dmitry Stogov Cc: zend-engine-cvs@lists.php.net Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) /zend_compile.c Yeah. I don't see why null should be allowed either. At 10:55 AM 11/15/2005, Derick Rethans wrote:On Tue, 15 Nov 2005, Dmitry Stogov wrote:your patch:Hello Dmitry, I didn't implement this because in those cases you should set the default to = array(), and this is working fine even beforedmitry Tue Nov 15 11:49:44 2005 EDTModified files: (Branch: PHP_5_1) /ZendEngine2 zend_compile.cLog: Allow "null" default value for arguments with array type hintfunction boo(array $ar = array()) { } This is why I didn't implement this for array, as it doesn'tmake muchsense to me. Derick -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php