Re: Refactored magic methods
| From: | Julien Pauli | Date: | Mon, 05 Aug 2013 14:56:54 +0000 |
| Subject: | Re: Refactored magic methods | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-68382@lists.php.net to get a copy of this message | ||
On Fri, Aug 2, 2013 at 9:55 PM, Levi Morrison <morrison.levi@gmail.com>wrote:
> If you have ideas or things to say, I'm listening.
>> https://github.com/jpauli/php-src/compare/macroing
>
>
> Is there a reason you switched from names like
__toString to
> __tostring
> (https://github.com/jpauli/php-src/compare/macroing#L2R12)?
>
Yes because I use the same word for structure members access and for error
message. That makes the refactoring takes place actually, if I had to
change just one letter to capitalize it for just one method, that would add
lots of code just for treating that particular case :-p
>
>
> Visually the macros clean things up a lot and better convey the intent
> behind the if / else if chain. However, I don't really like having a macro
> that works off of an ELSE, it just feels wrong. I don't
> have a better
> suggestion though.
>
Yes elses inside macros are not a good idea, I pushed a different
implementation having elses out of macro definitions.
Julien.Pauli