Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63363 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34563 invoked from network); 12 Oct 2012 08:30:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Oct 2012 08:30:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=amaury.bouchard@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=amaury.bouchard@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: amaury.bouchard@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:42522] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/15-06472-605D7705 for ; Fri, 12 Oct 2012 04:30:04 -0400 Received: by mail-ob0-f170.google.com with SMTP id ni5so2911825obc.29 for ; Fri, 12 Oct 2012 01:29:54 -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 :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=9M6Sj0NyOOyy+dfrFqYMh03aF+Qx54kNEia+hJwKG0Q=; b=ZssNUEzgIDmcl02mx7SMts1vjuPSkLOvriFc4SiG+AUH6/VcWrdJoXZsuOfPwTRpah CZPL/zYtVU6cmzM53fW8u0AwwnurtWxhOWYTY2kat5Aayni/xGQ3MX+xcIV2TeZrKtS3 yDsuc9jXIrruRjOOXOMahdoi4JKtrTWzyVcJxbso/F2Txq7gPno1IwAFFUxwh2JuIhTV be8ODYig/MAP3ZjTtfaGDL92k16LfKgarQwXQJV0NUUBZ2rMOBvmY9w9gXB0jrC8/n+t tNQcdK0KsAAoTgYt+hjo5gCZ5Wygib4cvTWPO1qKrW8rWIfQ+s+qlQx5XsJHNl3bTIR4 F1cQ== Received: by 10.60.169.234 with SMTP id ah10mr2984847oec.12.1350030594193; Fri, 12 Oct 2012 01:29:54 -0700 (PDT) MIME-Version: 1.0 Sender: amaury.bouchard@gmail.com Received: by 10.182.24.169 with HTTP; Fri, 12 Oct 2012 01:29:33 -0700 (PDT) In-Reply-To: <9570D903A3BECE4092E924C2985CE485612B53B2@MBX202.domain.local> References: <9570D903A3BECE4092E924C2985CE485612B3B48@MBX202.domain.local> <5073328D.5000002@gmail.com> <50735165.8010703@aaronholmes.net> <9570D903A3BECE4092E924C2985CE485612B4353@MBX202.domain.local> <760ab4f994a78a846cf86aafda71e0e2@mohiva.com> <9570D903A3BECE4092E924C2985CE485612B4EFE@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE485612B526F@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE485612B53B2@MBX202.domain.local> Date: Fri, 12 Oct 2012 10:29:33 +0200 X-Google-Sender-Auth: ZcQzVfR9jQAXwsGxICERZMb2Q08 Message-ID: To: Clint Priest Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=bcaec54d4d8e00b72904cbd87efe Subject: Re: [PHP-DEV] [RFC] Propety Accessors v1.1 From: amaury@amaury.net (Amaury Bouchard) --bcaec54d4d8e00b72904cbd87efe Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 2012/10/12 Clint Priest > I guess I didn=92t see any other support for it from others > Well, I get some bad replies (mainly from Andrew), but good ones too. Some people (like Matthew) said it was an elegant syntax... > and it is a subset of what the RFC I am proposing would encompass > Yes it's true, my proposal was focusing on a subset of your RFC. But this subset is - from my experience - the main usage of accessors. More, both can work together: My syntax could be used to define the visibility of reading and writing access, while yours is perfect to add processing on these accesses. > did I miss something with your original email? > I don't know. It's a matter of choice. I prefer to write: public:protected $a; protected:const $b; Rather than: public $a { protected set; } protected read-only $b; I saw you removed your new keywords. I think it's a good thing, because "const" was already here (no need for "read-only"). As I said, both syntaxes can work together. For example: public:protected $a { get() { return ($this->_prefix . $this->_a); } set($val) { $this->_a =3D substr($val, 1); } } The visibility is defined first (how I can use this property?), and then the code is available if needed (how does it work?). It's the same logic than when you write "private static function foo() { ... }". Maybe I'm the only one thinking we can imagine an elegant and understandable syntax that doesn't need to mimic what C# does. But still. :-) --bcaec54d4d8e00b72904cbd87efe--