Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78287 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48794 invoked from network); 24 Oct 2014 04:11:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2014 04:11:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=kalle.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kalle.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.178 as permitted sender) X-PHP-List-Original-Sender: kalle.php@gmail.com X-Host-Fingerprint: 209.85.217.178 mail-lb0-f178.google.com Received: from [209.85.217.178] ([209.85.217.178:57447] helo=mail-lb0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3B/73-24679-B71D9445 for ; Fri, 24 Oct 2014 00:11:40 -0400 Received: by mail-lb0-f178.google.com with SMTP id w7so1898692lbi.23 for ; Thu, 23 Oct 2014 21:11:36 -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:message-id:subject :from:to:cc:content-type; bh=l/99HbtYkgDtXenVaYR1MV05l48k+VKxScoLw0xWzbI=; b=F7nLjsa/+4gObUCNdRFTj1Sp+MHJF6Wv0/p5sXNKSKifyyBYbSnVh76vKJH+N1/ibg 3qwLkM9zjkhaD7wlOW7JLz1uDzQoaRa2Mm4/Uwmi8oiHsQUYSwVjfwuhihvw4VfulmZQ DYIJ0Xo2lXV94b2XMXQRfHOpYRHh8gP8fOWwIwpEhvMuP0hk9uFA/G3Jh7Jl1miJALFF kLu2HInYPVua3S9/BaKxHlxuAiEl33XtbIVix+O0A6EUkNfQtuJwO6OCK3mIUwN3Q9b6 8kz0efuYzNuNqD/9/LNzVia+Ag7ud+5MBFIzMCAq04H9oQPR4nDpubXhmtSloML6Bb2f 1W5Q== MIME-Version: 1.0 X-Received: by 10.153.9.7 with SMTP id do7mr117lad.98.1414123896772; Thu, 23 Oct 2014 21:11:36 -0700 (PDT) Sender: kalle.php@gmail.com Received: by 10.112.73.97 with HTTP; Thu, 23 Oct 2014 21:11:36 -0700 (PDT) In-Reply-To: References: <6E04B9BE-854E-4112-8C74-7D90BD8BFE95@ajf.me> Date: Fri, 24 Oct 2014 06:11:36 +0200 X-Google-Sender-Auth: nqvCCjs8Gjti6-Cy9YcVUY1LAzA Message-ID: To: Xinchen Hui Cc: Andrea Faulds , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Readonly Properties From: kalle@php.net (Kalle Sommer Nielsen) Hi 2014-10-24 5:02 GMT+02:00 Xinchen Hui : > Hey: > > -1 on this. > > Actually, your example for explaining usage.. > > I don't see why it is must, add a getSize() will also meet the > needs, and more beatiful, as you can change $size to another name if > you like later. I disagree on your disagreement, while it is not a must, it does not make much sense that we are gonna call what essential is a function to return a value that is not changed in anyway during that call. It does not really perform a function, other than returning a value in 99% of all cases, and therefore it makes perfect sense to allow readonly properties in my mind. It does not really make the code beautiful to prefix it with 'get' and suffix it with '()' when you want such a value, it makes it consistent, yes, but else it is just bloat to my eyes. Internally it should also be a slightly be faster to not having to call a method everytime as well, a program that does, lets say 50-100 calls to 'getX()' that can skip INIT_METHOD_CALL + DO_FCALL_BY_NAME and instead just a FETCH_OBJ_R which is what should be after the fcall, micro optimization I know (been a while since I went into these parts so I might be a bit off though). I'm a huge +1 on this, good job Andrea! -- regards, Kalle Sommer Nielsen kalle@php.net