Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63377 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69866 invoked from network); 12 Oct 2012 13:40:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Oct 2012 13:40: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.219.42 as permitted sender) X-PHP-List-Original-Sender: amaury.bouchard@gmail.com X-Host-Fingerprint: 209.85.219.42 mail-oa0-f42.google.com Received: from [209.85.219.42] ([209.85.219.42:57615] helo=mail-oa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/4C-06472-3BD18705 for ; Fri, 12 Oct 2012 09:40:08 -0400 Received: by mail-oa0-f42.google.com with SMTP id j1so3177382oag.29 for ; Fri, 12 Oct 2012 06:40:01 -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:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=81G+IF18jJKV9CM6uE7cOaBBJGSnZCnZPwCgtA4UdDI=; b=BR1xvpT+cl3OQ2UURqqoSh/V3lwpvTHiwOXBltg4Mgo+yWpSJ9ZCU5pRdyvD537mwR 50bbpOGp0U0vUHMpB0aaQ2lkN8M/MBA7BjiX/ym+Epgz/CwBTfofoMMfRynCJhHnxgtc dEGqjCc+sk61ulOCaaI3Lb6+Q6ZNRyoK5mGIabC98YV9zkaJ97sNcndudapvpNt5NWBl KzBOYtkZ7MUs36tl4EK3ju/2y4NRaJbVE1/AVgRvHcWoqZi6MTcSuWE4WEhQydHS14v1 XG3KY/okVprdZAJlCJaJDTCHpPzVGnCjnteln/V4hL87AJlJ7mLNPW7hwXAddZ3cDnIl cIEg== MIME-Version: 1.0 Received: by 10.182.222.72 with SMTP id qk8mr2188470obc.99.1350049200962; Fri, 12 Oct 2012 06:40:00 -0700 (PDT) Sender: amaury.bouchard@gmail.com Received: by 10.182.24.169 with HTTP; Fri, 12 Oct 2012 06:40:00 -0700 (PDT) Received: by 10.182.24.169 with HTTP; Fri, 12 Oct 2012 06:40:00 -0700 (PDT) In-Reply-To: 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 15:40:00 +0200 X-Google-Sender-Auth: WNobHZtzi_1eHadMveNqAkfKgbc Message-ID: To: Bernhard Schussek Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=f46d04462c460d7ade04cbdcd340 Subject: Re: [PHP-DEV] [RFC] Propety Accessors v1.1 From: amaury@amaury.net (Amaury Bouchard) --f46d04462c460d7ade04cbdcd340 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Le 12 oct. 2012 10:37, "Bernhard Schussek" a =E9crit = : > > 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); } > > } > > A shortcoming of this syntax is that it does not offer a solution for > the isset() and usset() accessors. Different visibility syntaxes for > get/set and isset/unset would be unlogical and confusing. Yes, you're right. But I never ever felt the need to define specific visibility for __isset. On the other hand, I'm using getters and setters everyday to manage the visibility of my object's attributes. (more about isset and unset at the end of this email) I'm trying to solve the main situation, not the special case. > Also, public:protected implies an order which does not have to be kept > in the block AFAIK. What is public and what is protected? Read it aloud. public $a { protected set; } =AB$a is publicly readable, and protected against writing.=BB Exactly the same: public:protected $a; =ABpublic read, protected write $a=BB Seems easy to understand. > public:protected $a { // ??? > protected isset() { ... } > private unset() { ... } > get() { ... } > set($value) { ... } > } I consider that isset() is covered by the attribute's reading visibility, and unset() is covered by writing visibility. If it's not obvious for you as it is for me, can you give me some code examples? --f46d04462c460d7ade04cbdcd340--