Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78302 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85883 invoked from network); 24 Oct 2014 11:12:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2014 11:12:04 -0000 Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 209.85.213.54 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.213.54 mail-yh0-f54.google.com Received: from [209.85.213.54] ([209.85.213.54:38388] helo=mail-yh0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/00-19734-3043A445 for ; Fri, 24 Oct 2014 07:12:04 -0400 Received: by mail-yh0-f54.google.com with SMTP id 29so388132yhl.41 for ; Fri, 24 Oct 2014 04:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Py86Db/YazvUnPm1FBrq7d4NUIi8aqnkm9z8j4bXrVU=; b=s1ukoGJ2jVMYDwiTHR/U04XQZttpcYcU5HxhsZjHvReOzONjfq4+r7/edGgy/SImtr CeDtY1gY+nge0+RHkWQoo9Rmf1jZSwE5mc8RA6Px8w0ycaM3uxaIJEI78FVdYeJsaMSx yxqFI8UXy0Yu5N/ruMgz0o1dyctIa8pb5NzlU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Py86Db/YazvUnPm1FBrq7d4NUIi8aqnkm9z8j4bXrVU=; b=LNDocwhHvfkZ/hfHmzhBk08V6NtNedv4Is5KNVFm78BtbkFsozB9ZYd5Yjyr/sTLlN NZX7LA+UvNmJ/KH86EAqKmBDjlhZ2ts4bzEXkrJvCFHEu1RZKhkOtfgF3GfwzuCVZ4SL DFOe6ZbAXvml5lM3cpW4UOCzkxJsqinL1LTMvKFH+JedO6g6/DxwlYj5iVEUr6CWHPzR +p2B47W2T/KA08WLAeBI4T6QnDJJ93UxYB4IPzc6xG1RlT6uStS7cF6bngbmjnK827bo /pqzRqvtIcfBlUzjmYdSOxtu7jmn4J+QibegAv8AiOqJN59Zq9QByooVxZBkKsch0zdZ NJRA== X-Gm-Message-State: ALoCoQnwK7lTsA5vGiGDECiLIqmpeqz+JR34vw8jXn4by9jqjf8yh35r8XTZN1OFF/1urLYubPVW MIME-Version: 1.0 X-Received: by 10.170.71.8 with SMTP id n8mr5590961ykn.63.1414149120981; Fri, 24 Oct 2014 04:12:00 -0700 (PDT) Received: by 10.202.75.71 with HTTP; Fri, 24 Oct 2014 04:12:00 -0700 (PDT) In-Reply-To: References: <6E04B9BE-854E-4112-8C74-7D90BD8BFE95@ajf.me> Date: Fri, 24 Oct 2014 14:12:00 +0300 Message-ID: To: Pierre Joye Cc: Andrea Faulds , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Readonly Properties From: narf@devilix.net (Andrey Andreev) Hi, On Fri, Oct 24, 2014 at 12:34 PM, Pierre Joye wrote: > hi Andrea, > > On Fri, Oct 24, 2014 at 6:36 AM, Andrea Faulds wrote: >> Good evening once again, >> >> Here=E2=80=99s another RFC: https://wiki.php.net/rfc/readonly_properties >> >> It proposes, with a working implementation, a modifier for properties th= at makes them readable and writeable from different scopes. >> >> Since I am a big proponent of including specification patches in new RFC= s, I have decided to put my money (or rather, time) where my mouth is and I= have actually written a specification patch before writing an RFC. I would= love to see this become the new standard for RFCs affecting the language. >> >> If you are curious at all about the behaviour, I suggest perusing the fa= irly comprehensive set of twelve tests included in the main patch to php-sr= c. > > As much i really like the idea to have better properties management in > PHP I see this RFC as an attempt to solve only part of the problem > while dropping most of the other ideas implemented in the past RFCs. > My take on that is that some will vote no, or won't like the idea of > adding anything in this area. Making compromises and implement partial > solutions will only delay the implementation of the complete solution. > > Many of us agree that __get/__set is a pain to deal with.The need of > readonly, writeonly or properties with some logic to define or get a > value is a lond due need. Many other languages support that out of the > box since long already. Past RFCs, like the c# one, proposed that. I > would rather focus on trying to find an acceptable syntax and > implementation instead of doing baby steps like that. Baby steps work > very well for scalar type hinting, solving one issue after another, > etc. But for properties we are at the risk of hainvg a serie of > separate RFCs solving the properties management problems in different > ways bringing even more troubles and inconsistencies. Pierre, I rarely disagree with you, but this is one such case. It is true that we can look at this as a partial solution to a bigger problem, or as you said - a baby step. However, I see this as the perfect solution for a very narrow, yet also a very common problem, and I don't see it blocking a more abstract solution in the future. From a userland POV, it is simple, very effective and there's practically no way to achieve the same goal with less amount of code. In short - it's no panacea to all the limitations that we currently have on property management, but it is still *extremely* useful for implementing classes that only need to have getters. On another note, I share Nikita's concern about using the "readonly" keyword and I'd love that to be improved, but the best alternative I could think of is "readable" and IMO it doesn't have a clearer meaning. Cheers, Andrey.