Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68689 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30312 invoked from network); 29 Aug 2013 15:59:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2013 15:59:35 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.174 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.214.174 mail-ob0-f174.google.com Received: from [209.85.214.174] ([209.85.214.174:54100] helo=mail-ob0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C6/73-10946-6EF6F125 for ; Thu, 29 Aug 2013 11:59:34 -0400 Received: by mail-ob0-f174.google.com with SMTP id wd6so675254obb.19 for ; Thu, 29 Aug 2013 08:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vV3ofg3BU+Y5NrrN/T1ayvyj0Xo/ChNXKMDmpmKWMDU=; b=bJhCbRsOkBZHrtO07U450s8O0etRzbLYBOZjXxZATh+xhR7IiZDtQJIMKCgKlpR6+D MEWS0OCBfZygZiZE27CH521zfiSLSdndxWncDlVFenAerQUsj1FRxW+3kTkkJoFs17om DJHdskTfQCkE5NWM9CFzCIKZ17INKAEJhx1+6ts8EGXJOz785dOrjNgmDmMmlEBk91fb i4T4kKa2DDCdm8QeP3neX0+HNZPvzG2/2lLpEcyERAfJL6V7xYkL8TsFqyxpHD+QdaOb hSJKYu5no7GUBx4k6iFkAjNDH2OWf0Sqd5vI4RKtLLEri/MXYzuuthFK7AinYpjwhT5C BKgg== MIME-Version: 1.0 X-Received: by 10.60.93.105 with SMTP id ct9mr3036764oeb.42.1377791972189; Thu, 29 Aug 2013 08:59:32 -0700 (PDT) Received: by 10.76.122.200 with HTTP; Thu, 29 Aug 2013 08:59:32 -0700 (PDT) In-Reply-To: References: Date: Thu, 29 Aug 2013 09:59:32 -0600 Message-ID: To: Nikita Popov Cc: Julien Pauli , PHP Internals Content-Type: multipart/alternative; boundary=047d7b33d5a013ac8b04e5183147 Subject: Re: [PHP-DEV] Refactored magic methods From: morrison.levi@gmail.com (Levi Morrison) --047d7b33d5a013ac8b04e5183147 Content-Type: text/plain; charset=ISO-8859-1 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. --047d7b33d5a013ac8b04e5183147--