On Thu, Aug 29, 2013 at 5:59 PM, Levi Morrison <morrison.l...@gmail.com>wrote:
> On Thu, Aug 29, 2013 at 5:00 AM, Nikita Popov <nikita....@gmail.com>wrote: > >> On Fri, Aug 2, 2013 at 6:47 PM, Julien Pauli <jpa...@php.net> wrote: >> >> > Hi internals. >> > >> > I started a work of refactoring magic methods from internals. >> > >> > The first goal was to never write ourselves things like "__get", but use >> > macros for those names. (get, set, invoke, etc...). >> > >> > A second goal was to rewrite some parts of the compiler which looked >> like >> > code duplication which could benefit from macro refactoring. >> > >> > I did that. >> > All tests pass. >> > >> > It may look uglier for people who dont like having more macros, but >> anyway, >> > we can cherry pick some commits, etc... >> > >> > If you have ideas or things to say, I'm listening. >> > https://github.com/jpauli/php-src/compare/macroing >> > >> >> I'm not really a fan of heavy macro usage, so here an alternative >> suggestion: >> >> >> >> https://github.com/nikic/php-src/commit/375bd7911fd117696b8b5d63c104fd588d69c409 >> >> Basically, instead of going through all the magic methods manually we >> define a structure holding information on magic methods and then loop >> through it doing generic checks. >> >> The above example only changes zend_check_magic_method_implementation, but >> the idea can be generalized to the other occurances of magic method checks >> (making the structure a global constant so they can all make use of the >> information in there.) >> >> Nikita >> > > I think I like Nikita's version better. Fewer macros are nicer in my > opinion. > I like yes, I think we can mix both by having a global containing all magic method infos, and some macros to use them. I'll propose another patch based on that ;-) Thank you, Julien.Pauli