Posted by Tony Marston on 12/02/06 12:05
"Michael Fesser" <netizen@gmx.de> wrote in message
news:u4f0n2tpfkfscou9beeq5pig121dhd9edf@4ax.com...
> .oO(Tony Marston)
>
>>> Just an example: Without
>>> these interfaces it wouldn't be possible to use 'foreach' to iterate
>>> over any arbitrary object:
>>>
>>> foreach ($directory as $file) {...}
>>> foreach ($resultSet as $record) {...}
>>
>>With PHP 5 it is possible to use 'foreach' on an object without the use of
>>interfaces, so your argument is not valid.
>
> It's a huge difference whether you just loop through all of the object's
> properties like an array (that's what you described above) or if each
> iteration automatically calls a particular method, which for example
> fetches the next record from a database.
>
> The latter is the basis of the SPL extension and not possible without
> interfaces. Maybe IYHO the entire extension is not valid as well?
>
> Micha
I have no opinion on the SPL extension as I have never used it. That
argument is irrelevant anyway. The point being debated here is whether
interfaces in PHP are necessary, and it is my opinion that they are NOT.
--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
[Back to original message]
|