Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) /zend_compile.c

From: Date: Fri, 18 Nov 2005 22:58:15 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) /zend_compile.c
References: 1 2 3 4 5  Groups: php.zend-engine.cvs 
Request: Send a blank email to [email protected] to get a copy of this message
Hello Andi,

Friday, November 18, 2005, 11:52:56 PM, you wrote:

> I wasn't thinking about it from a purist language design point of 
> view. It just seemed to me to be mixing apples and oranges. If 
> someone indeed wants to use default params with array typehints, then 
> at least we should make sure he has a true array so that he can use 
> it without warnings in any array/foreach whatever function. 
> is_array() should be true. I just think this isn't consistent.

Well, you can still do "= array()" instead of "= null" or not have a
default value at all. So one needs to explicitly allow null. I guess
it is clear that you then have to check for null.

regards
marcus

> At 02:40 PM 11/18/2005, Marcus Boerger wrote:
>>Hello Andi,
>>
>>Friday, November 18, 2005, 8:30:09 PM, you wrote:
>>
>> > 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.
>>
>>That's a very purist oppinion and somehow contradicts php's kiss approach.
>>In th ebeginning i was against this too. Just because language design theory
>>would forbit this (unless we have a syntax to explicitly allow null too).
>>However a lot of users want this and even though those designs are probably
>>considered very bad from any university it seems to help them.
>>
>>
>> >>In real OOP languages "array" just a special class.
>>
>>Oh you refer to stipped down languages like Java?
>>
>>regards
>>marcus




Best regards,
 Marcus


Thread (19 messages)

« previous php.zend-engine.cvs (#4368) next »