Re: Traits and Conflicts: Collisions as Warnings or Fatal?
| From: | Derick Rethans | Date: | Tue, 07 Dec 2010 12:03:43 +0000 |
| Subject: | Re: Traits and Conflicts: Collisions as Warnings or Fatal? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50893@lists.php.net to get a copy of this message | ||
On Sun, 5 Dec 2010, Stefan Marr wrote:
> While preparing some explanations on how to use traits, I stumbled
> over an inconsistency in the current implementation.
>
> Currently collisions, if they are explicit in the code, lead to a
> warning and are resolved by explicit exclusion of the two methods that
> collide[1]. However, there are other ways to provoke a collision, for
> instance by introducing a new alias during composition[2].
>
> [1]
> http://svn.php.net/viewvc/php/php-src/trunk/Zend/tests/traits/error_015.phpt?revision=305512&view=markup
> [2]
> http://svn.php.net/viewvc/php/php-src/trunk/Zend/tests/traits/language010.phpt?revision=305512&view=markup
>
>
> Collisions usually point to implementations that changed unexpectedly,
> and the implicit resolution might be problematic since it could hide
> the real cause for a bug.
>
> So, should that warning be changed to a fatal error, or should the
> other fatals be warnings, too?
IMO they should be fatal because your code is "broken".
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug