Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63416 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81565 invoked from network); 15 Oct 2012 14:19:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Oct 2012 14:19:21 -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.212.170 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:46309] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/E6-42204-86B1C705 for ; Mon, 15 Oct 2012 10:19:20 -0400 Received: by mail-wi0-f170.google.com with SMTP id hm2so43446wib.5 for ; Mon, 15 Oct 2012 07:19:17 -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:content-transfer-encoding; bh=6PPYGbeCwK98pUQ7lEo6gP6s+3p5B5aEGoR47fN/DJE=; b=vqnuKU9HlwMeu8WR9DfW/9DD/QDl9PldXt2dgs75lMw70YbvwnzLNHfR9bQS81KUGT zteMIxJNp0rLn742OBNfEF/q31Vywat80mJjZ2ahRyJV7odbWJ8/6q/njNGSk6OKH2/c WuzqL4Q9cOFKyno9L6XVyYvnvvRdQht++ZZlvfdq15amyFNNkbejnf/3iJIczWvQ75Is t98cEgpBubonBjsv0mNzxDeq4w91XWfTwTSpgnZLgK2ciBx89yCogUfHuVdR4Wi+kf9C YePFAGySjF45nB4zyuHD9iTUeArLO9rMh0LqM7M8ZVbOdQuC7SOijhOG11bDozGhXMeQ 5vkQ== MIME-Version: 1.0 Received: by 10.216.194.26 with SMTP id l26mr6745960wen.17.1350310757178; Mon, 15 Oct 2012 07:19:17 -0700 (PDT) Received: by 10.194.40.40 with HTTP; Mon, 15 Oct 2012 07:19:17 -0700 (PDT) In-Reply-To: References: <9570D903A3BECE4092E924C2985CE485612B6466@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE485612B655A@MBX202.domain.local> Date: Mon, 15 Oct 2012 08:19:17 -0600 Message-ID: To: Etienne Kneuss Cc: Clint Priest , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Interfaces From: morrison.levi@gmail.com (Levi Morrison) On Mon, Oct 15, 2012 at 8:09 AM, Etienne Kneuss wrote: > Hi, > > On Mon, Oct 15, 2012 at 3:55 PM, Clint Priest wrote= : >> I would bet, that at present, what you've put down is not allowed becaus= e I purposely leveraged functions in this regard because all of the restric= tions put in place against functions would apply to accessors (because they= are functions). I would have to test it to be certain though. >> >> Because of Nikita's desire to not have underlying __getXX() functions ex= posed in any way this may have to change. I had spent several hours actual= ly divorcing the created function from the Functions HashTable and later re= alized I could simply enforce their non-existence at call time, this has tu= rned somewhat problematic for static accessors though. >> >> Also, your "should be valid" statement implies that you feel properties = and accessors are the same and they are not, internally. When a class atte= mpts to implement an interface a "function check" is done and since there i= s no __getXX() function defined it would fail to implementation check again= st an interface. >> >> I cannot stress enough that properties !=3D accessors in any way except = the syntax in which they are used ($o->xyz) or ($o->xyz =3D 1), that is the= ir *only* similarity. > > I not saying accessors are properties. I'm saying that interfaces > define usage contracts. And from the point of view of usage contacts: > > interface A { > public $a {get; set; } > } > > is entirely fulfilled by the class: > > class B extends A { > public $a; > } > > You can see a public property as an underlying private property with > all usual public accessors defined. > > From the point of view of the user both should be interchangeable transpa= rently. I support this idea. Dart used this method before they removed interfaces from the language altogether and it seemed to work well. Is it completely obvious? No, it's not. I honestly don't think it matters, though, because people who will use this will use interfaces. As already mentioned, interfaces typically are not typically used in PHP. The fact that it isn't 100% obvious is a non-issue in my opinon.