Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63389 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56586 invoked from network); 13 Oct 2012 10:00:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Oct 2012 10:00:15 -0000 Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 209.85.215.42 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 209.85.215.42 mail-la0-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:64685] helo=mail-la0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/E9-06472-EAB39705 for ; Sat, 13 Oct 2012 06:00:15 -0400 Received: by mail-la0-f42.google.com with SMTP id e6so2515484lah.29 for ; Sat, 13 Oct 2012 03:00:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=hIYQs53aqNHcoJEiTqAun+1V6NHyzB9wmGquz+PqV/0=; b=WngboKSxY1X0utjI2oxMVp+RnBa8oS1VI50LoGz4iQFEb6omZdDPe+sAWqXF16/3fK b6iN51sKLkbACmNvYs3fSKJKsMebCuTEe1MJsot1Ka7utvJGiDhA2WFnsCS4k78PE2IC ZjYiDflxw64Kd5v9JzRfmb+dmIbulwQ7rsyilA+P794Ga4NvG5lUE4y67m9Ned1Hy1Wa kaWybQ4Jd44X+6vvux2D8G8IGeYqhjWIvuOfFrvKH81Ice1MwaQrbjdraH1+fX8op0Cm XOG0wGe/sHNO17HgLYANnRUcH155s5i0UUG5mij7TtjJY+65NnNdpiiB9/iUvXmBcq3G ztMg== MIME-Version: 1.0 Received: by 10.112.26.135 with SMTP id l7mr2531724lbg.84.1350122411066; Sat, 13 Oct 2012 03:00:11 -0700 (PDT) Received: by 10.112.132.102 with HTTP; Sat, 13 Oct 2012 03:00:11 -0700 (PDT) X-Originating-IP: [93.129.128.5] In-Reply-To: References: <9570D903A3BECE4092E924C2985CE485612B53E4@MBX202.domain.local> Date: Sat, 13 Oct 2012 12:00:11 +0200 Message-ID: To: Nikita Popov Cc: Clint Priest , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=bcaec554d424b705c404cbeddee2 X-Gm-Message-State: ALoCoQmuhc267B6PO8V9INVBQi4lFOoY6QHIsLpxQwnQSYGmsnd+gjEIEKSKpZkJWKs5kepmBtCx Subject: Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 From: kontakt@beberlei.de (Benjamin Eberlei) --bcaec554d424b705c404cbeddee2 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Oct 13, 2012 at 11:29 AM, Nikita Popov wrote: > 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; > Ah yes, of course. Sorry, stupid me :-) > > 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 > --bcaec554d424b705c404cbeddee2--