Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43729 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4226 invoked from network); 18 Apr 2009 17:27:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2009 17:27:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 69.16.228.148 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 69.16.228.148 unknown Linux 2.4/2.6 Received: from [69.16.228.148] ([69.16.228.148:50007] helo=host.fmethod.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/A1-24459-37D0AE94 for ; Sat, 18 Apr 2009 13:27:16 -0400 Received: from [83.228.56.37] (port=3253 helo=pc) by host.fmethod.com with esmtpa (Exim 4.69) (envelope-from ) id 1LvEJr-0006UE-BO for internals@lists.php.net; Sat, 18 Apr 2009 12:27:11 -0500 Message-ID: To: References: <52F25C37-F12D-4A85-A7D3-C579637B56C5@stefan-marr.de> <3B04560F-97DC-423D-8606-3436F28EF2D1@stefan-marr.de> Date: Sat, 18 Apr 2009 20:27:03 +0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.fmethod.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fmethod.com Subject: Re: [PHP-DEV] Grafts, Traits, horizontal reuse From: sv_forums@fmethod.com ("Stan Vassilev | FM") > The question here is how to handle property accesses, in particular > accesses to unspecified properties. > I actually would expect to have a lookup mechanism which first looks in > the trait, and if the property is not found there, its going to the > object. I expect this behavior, because it is similar to what we have > with inheritance and properties defined by a superclass. > > If a property is not jet defined, I would expect it to be created in the > most inner scope, like local variables. > On the other hand, I also would expect, as in inheritance, properties to > be found defined by super classes, or the class which defines the > composition. > > But this only my intuitive solution, so this could of course be specified > different. > > Best regards > Stefan Hi, I see this in a much simpler fashion. Treat traits as a preprocessor step semantically. Internally, trait methods on multiple classes may point to the same method to save resources, but in my opinion there's no need to complicate matter by introducing new resolution rules, scopes, and so on. The way I see it: 1) Property/Method name conflicts on trait/class, within the class including the trait raises Fatal Error. 2) Extending classes can override the property/method, unless it's a final method, just like as if they override normal parent class property/method. 3) There's a single space for a class property and its trait properties, so access works as if it was all class properties. Feedback? Regards, Stan Vassilev