Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78300 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81401 invoked from network); 24 Oct 2014 10:30:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2014 10:30:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=florian@margaine.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=florian@margaine.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain margaine.com from 209.85.213.41 cause and error) X-PHP-List-Original-Sender: florian@margaine.com X-Host-Fingerprint: 209.85.213.41 mail-yh0-f41.google.com Received: from [209.85.213.41] ([209.85.213.41:38445] helo=mail-yh0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D9/13-62277-C3A2A445 for ; Fri, 24 Oct 2014 06:30:25 -0400 Received: by mail-yh0-f41.google.com with SMTP id i57so82823yha.28 for ; Fri, 24 Oct 2014 03:30:17 -0700 (PDT) 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:from:date :message-id:subject:to:content-type; bh=Urqwkmjlv1O7waEEh1JTFE4FmvDsLq34WG4SaiQuMbE=; b=ZwXmt0tK1oZaG0hpFY2qW/0XSi4kj1NUG4PIQ0v/nmBI+y3+04xKyAt5qiQ04kKa6a ZQoDk3MWhVPdKD+zyV7nGauQEDqiW6lVhea4cmsFj9+AaH9jLTD/N6XWWUzp+kSDYemL TOEAe9rVIciQFfV51avWUDu3oHhZsj3sFAWgfmGN2jUfJIVumGlqlecCUHd9qLk88zHA GA97meLQgJol3XszqGOimuI1thMxGaKvAnEOP/dSMUUf6jgQxgpdn9GTZirPETMPmCCq nW2F+Hb/OGM9snT6ZfvTRvRlZYTX/02L2hJAY0ly5eEDxSTjcCR5ATxqMOBrpeMjfb9I fiDw== X-Gm-Message-State: ALoCoQmXZ9Vi17waYYmIkSWx9dKuxYnhHXmpytCeN9rVrnuKJ74AVd9ki8FRON32mUQsenUnGDEe X-Received: by 10.170.49.147 with SMTP id 141mr5239541ykr.14.1414146617576; Fri, 24 Oct 2014 03:30:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.25.200 with HTTP; Fri, 24 Oct 2014 03:29:57 -0700 (PDT) X-Originating-IP: [92.132.226.243] In-Reply-To: <20141024102157.GO4025@phcomp.co.uk> References: <6E04B9BE-854E-4112-8C74-7D90BD8BFE95@ajf.me> <20141024102157.GO4025@phcomp.co.uk> Date: Fri, 24 Oct 2014 12:29:57 +0200 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=001a11c041becd22b7050628aaba Subject: Re: [PHP-DEV] [RFC] Readonly Properties From: florian@margaine.com (Florian Margaine) --001a11c041becd22b7050628aaba Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, On Fri, Oct 24, 2014 at 12:21 PM, Alain Williams wrote: > On Fri, Oct 24, 2014 at 10:41:38AM +0200, Patrick Schaaf wrote: > > Am 24.10.2014 01:36 schrieb "Andrea Faulds" : > > > > > > Here=E2=80=99s another RFC: https://wiki.php.net/rfc/readonly_propert= ies > > > > +1 for the general feature, I'd love to have that available. > > > > I have an idea regarding the additional keyword, with a small implicati= on > > (improvement) to the functionality provided, but at the cost of being > > slightly quirky :) The idea is: > > > > public $foo as private; > > public $bar as protected; > > protected $baz as private; > > > > where the "as X" gives the writability scope. This introduces no new > > keywords, and is currently not valid syntax, as far as I can see. > > More as musing than anything else - might provide some insight via an > analogy. > > Properties and methods have a scope that is: private, protected or public= . > This reminds me of the Unix: owner, group & other file permissions. > > Unix allows: read, write & execute. > > This RFC is trying to control how a property could be used with a readonl= y > restriction. > Are there times when one would want to be able to set a property value - > but not > read it ? > > Thinking about execute - would there be any mileage in an execute > permission - > could be useful for a property that had been assigned an anonymous > function. > > > Finally we could bring it all together and sidestep the scoping keywords > using > 'var' instead. Thus: > > var $callback as 0751; > > Would define a property that contains an anonymous function that could be > called > by anyone, inspected by the class & related class, but only set by the > class itself! > To follow up on this, and to give more readable code, we could also use this: var $callback as rwxrw---x; > > -- > Alain Williams > Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, I= T > Lecturer. > +44 (0) 787 668 0256 http://www.phcomp.co.uk/ > Parliament Hill Computers Ltd. Registration Information: > http://www.phcomp.co.uk/contact.php > #include > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > Regards, --=20 Florian Margaine --001a11c041becd22b7050628aaba--