Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78423 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52932 invoked from network); 28 Oct 2014 13:58:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Oct 2014 13:58:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.171 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.171 mail-wi0-f171.google.com Received: from [209.85.212.171] ([209.85.212.171:61748] helo=mail-wi0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/64-21571-411AF445 for ; Tue, 28 Oct 2014 08:58:44 -0500 Received: by mail-wi0-f171.google.com with SMTP id hi2so5844935wib.10 for ; Tue, 28 Oct 2014 06:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=Qjbmh/MQnOtT43GNzJKko3tcJDpICla2aJI3fi7JqEs=; b=iU1784YkxS/DBA4qI2sRZKYru0mxr4IJAXqsBf6QiGweICax6K8d3GNlxeixxdBQym hLArsq1eEvRZoWXwLCudmIclZSncQ38ZxnBIiLP1ejq5mASY6TzqsiyzghYWbsHnK9Qf 11WadEKlNzqZmn5hxgPaYGLtO4DgfozaMrBZbIVauLV7o86rDnbh+g+tG0vYmEV7X7Wd PAJiFfvuMpTxophAuSMcIpTIbmrtfspFQ4inoYU4T47T0bFcQaDg42sGIuWFBlJyMQ9Z DFcdTQHjkMxT1v0pRiKcaQQM95GwosTAmrj6knz5pclXs2BtVS8lmtLJtvC/4CqqgeLc D9CA== X-Received: by 10.180.20.8 with SMTP id j8mr5113273wie.60.1414504721156; Tue, 28 Oct 2014 06:58:41 -0700 (PDT) Received: from [192.168.0.177] ([62.189.198.114]) by mx.google.com with ESMTPSA id fr6sm2331164wic.1.2014.10.28.06.58.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Oct 2014 06:58:40 -0700 (PDT) Message-ID: <544FA10E.7030100@gmail.com> Date: Tue, 28 Oct 2014 13:58:38 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: <6E04B9BE-854E-4112-8C74-7D90BD8BFE95@ajf.me> <544D48A3.6070905@gmail.com> <572FEBD1-99A8-4788-83F9-D99E470FB16D@ajf.me> <544F4321.8040302@seld.be> In-Reply-To: <544F4321.8040302@seld.be> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Readonly Properties From: rowan.collins@gmail.com (Rowan Collins) Jordi Boggiano wrote on 28/10/2014 07:17: > How about this instead for readonly: > > public $foobar { > get { return $this->bar * $this->foo; }; readonly > } > > And if the flag isn't there, set is implicitly present. > > That'd mean you also can keep "public readonly $foobar;" as a > shorthand for readonly properties without custom getter. I think it could be problematic to have too many variants of the syntax, as it leads to more inconsistencies that people have to understand, and more complex code needed in third-party parsers (IDEs, alternative implementations, etc). Keeping the "readonly" attribute also keeps the ambiguity of what it actually means: immutable, protected, private? Sticking to the existing visibility modifiers makes it more explicit what's actually being set. -- Rowan Collins [IMSoP]