Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63387 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52451 invoked from network); 13 Oct 2012 09:29:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Oct 2012 09:29:55 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:37818] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2A/39-06472-19439705 for ; Sat, 13 Oct 2012 05:29:54 -0400 Received: by mail-lb0-f170.google.com with SMTP id gm13so2578647lbb.29 for ; Sat, 13 Oct 2012 02:29:51 -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=q3642941CbsgGwdf+MyvVckMlF0j4UthflHI60MMB8Y=; b=jqpMBU+RcCrkjjIII54R1vpQ68MEvy9nrbTC12TItYWNiCjhL0pstowihdtmwish9Z rTLZqc6C8Ba2d9Vv9vK0PN/caRe3DNs3Dlgvn2MgtqV98lpBwKEubMld2KAVIfE/PcfU h95q1Q/PIpVVYnECVIp/nRxSF0B8TCd2uZrTaNG08P3ch+zt4gSlgPwmnK8RTrHH7h6O cfjrBT5VVGrcN/iQ8HhQczRs5m8JXQzidLZu0b1CeejJxsh4NHDrs/Yn+GJKieaI/TBC 4LdWQbyCkT+Uwr9mDmXPzhXokGPDDGTGzx/o/7WgW78kKbOnj826F8J0hXkGrLG2dDBZ aV5w== MIME-Version: 1.0 Received: by 10.152.148.40 with SMTP id tp8mr5817638lab.30.1350120591052; Sat, 13 Oct 2012 02:29:51 -0700 (PDT) Received: by 10.112.83.100 with HTTP; Sat, 13 Oct 2012 02:29:50 -0700 (PDT) In-Reply-To: References: <9570D903A3BECE4092E924C2985CE485612B53E4@MBX202.domain.local> Date: Sat, 13 Oct 2012 11:29:50 +0200 Message-ID: To: Benjamin Eberlei Cc: Clint Priest , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 From: nikita.ppv@gmail.com (Nikita Popov) On Sat, Oct 13, 2012 at 10:06 AM, Benjamin Eberlei wrote: > Can we discuss the removal of automatic get; set; again? For me that was > the best feature of the whole RFC, essentially allowing to define a > property with getter/setter in 1 LOC. Allowing future overriding of that > getter/Setter if the application required it. > > This is absolutely essential for database backed recods which will have > tons of those property accessors. Now if i apply PSR coding styles to > accessors, then i end up with 11 LOC for accessors defining a property, a > property accessor and get/set functions, compared to 10 LOC with usual > getter/setters. Not sure I quite understand you. What prevents you from just using a normal public property? public $property; Accessors give you the ability to add alternative behavior for the property lateron (this is actually the main use I personally see in this RFC: Not actually using it, but having the possibility of using it). The only place (which I see off the top of my head) where property / automatic property makes a difference is interfaces. In the current implementation interfaces can only define properties with accessors. So: interface Foo { // this is okay public $abc { get; set; } // this is invalid public $abc; } And similarly you can't implement the public $abc { get; set; } definition from the interface using a plain property. I think that properties should be definable in interfaces, or at a normal property "public $abc;" should satisfy the interface "public $abc { get; set; }" (I mean, it kinda does from a functional point of view, right?) Nikita