Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68690 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31996 invoked from network); 29 Aug 2013 16:08:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2013 16:08:12 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.174 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.220.174 mail-vc0-f174.google.com Received: from [209.85.220.174] ([209.85.220.174:35086] helo=mail-vc0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/D3-10946-AE17F125 for ; Thu, 29 Aug 2013 12:08:11 -0400 Received: by mail-vc0-f174.google.com with SMTP id gd11so454433vcb.19 for ; Thu, 29 Aug 2013 09:08:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=IVMHCMfDJvFuFFWrxsr1lSQezGiE8NZdpT/+Rch2JCc=; b=fZyb5Nkv84J3gXVyPLOdDJc2LbxYCLo0VgTNqm2HgLqRL7tmszYo5r0eV2eKAreHKA TV2sXUQQR7/Ntr1SPHfA1akglDIoa5S1qr9DKitoV228cKcyeMhJ7b/pjY87d77T+IJ/ vFM1QJsHb/ZVK21eGbPPvqf4C0h4pvY+tr5QnFHFxoT4qSpnxxMX9Idns62wCgmx8TZE SHs2Jka+bl9HcVzHFBAhZiFrXwdQlZA1ebM0B1yh8irb0ELm8FFJZZ92bZaWzEbw16+P 5Wd6UyOH1c8Ioc81/e9LiM/Dh9pGuuWv/WS7U0jLzgkMf4H/z4BK0DtTUy9ZWGwGiV/v X0yg== X-Received: by 10.220.249.67 with SMTP id mj3mr2274596vcb.23.1377792487912; Thu, 29 Aug 2013 09:08:07 -0700 (PDT) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.220.73.197 with HTTP; Thu, 29 Aug 2013 09:07:27 -0700 (PDT) In-Reply-To: References: Date: Thu, 29 Aug 2013 18:07:27 +0200 X-Google-Sender-Auth: _UK5WSKHIWaeX2r4JQUQCwrbTe0 Message-ID: To: Levi Morrison Cc: Nikita Popov , PHP Internals Content-Type: multipart/alternative; boundary=089e013a15e6d0f92704e5184f9e Subject: Re: [PHP-DEV] Refactored magic methods From: jpauli@php.net (Julien Pauli) --089e013a15e6d0f92704e5184f9e Content-Type: text/plain; charset=ISO-8859-1 On Thu, Aug 29, 2013 at 5:59 PM, Levi Morrison wrote: > On Thu, Aug 29, 2013 at 5:00 AM, Nikita Popov wrote: > >> On Fri, Aug 2, 2013 at 6:47 PM, Julien Pauli 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 --089e013a15e6d0f92704e5184f9e--