Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62458 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54552 invoked from network); 24 Aug 2012 21:00:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Aug 2012 21:00:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:34016] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/95-24287-76BE7305 for ; Fri, 24 Aug 2012 17:00:24 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 21B3470003D2; Fri, 24 Aug 2012 22:00:20 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id D45rGP-ZYgHL; Fri, 24 Aug 2012 22:00:19 +0100 (WEST) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 713EC70003C9; Fri, 24 Aug 2012 22:00:19 +0100 (WEST) Received: from damnation.nl.lo.geleia.net (unknown [IPv6:2001:470:94a2:4:21d:baff:feee:cc0b]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id D29E52023237; Fri, 24 Aug 2012 22:00:16 +0100 (WEST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: dukeofgaming , "Anthony Ferrara" Cc: "Peter Nguyen" , "Sebastian Krebs" , internals@lists.php.net References: <50369892.6080106@googlemail.com> Date: Fri, 24 Aug 2012 23:00:25 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: User-Agent: Opera Mail/12.01 (Linux) Subject: Re: [PHP-DEV] Aspect Oriented Programming in PHP From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Fri, 24 Aug 2012 19:18:40 +0200, Anthony Ferrara wrote: > Just a pedantic note here. You don't need any special functionality to do > AOP style programming in PHP. In fact, this use-case is the exact > definition of a Decorator. > > Instead of hooking in with a function call and cut-points, you would just > decorate the object you want to interact with, and you're set. Then just > add your functionality where it's needed. > I think you're missing the fundamental difference between decorators and AOP or interceptors. Decorators augment the object with domain-specific additions, while interceptors are more appropriate for orthogonal concerns. CDI (JSR 299/346) has both. Their interceptors are slightly different from traditional AOP in that you don't have the usual pointcut syntax, and decoration is done is done automatically upon injection. You might want to take a look nevertheless; this is the weld (CDI reference implementation) documentation: * http://docs.jboss.org/weld/reference/latest/en-US/html/interceptors.html * http://docs.jboss.org/weld/reference/latest/en-US/html/decorators.html -- Gustavo Lopes