Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98795 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68222 invoked from network); 14 Apr 2017 05:10:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Apr 2017 05:10:10 -0000 Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.179 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 209.85.161.179 mail-yw0-f179.google.com Received: from [209.85.161.179] ([209.85.161.179:33456] helo=mail-yw0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/63-31410-0B950F85 for ; Fri, 14 Apr 2017 01:10:09 -0400 Received: by mail-yw0-f179.google.com with SMTP id l189so32638624ywb.0 for ; Thu, 13 Apr 2017 22:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=04UdtNaK+8ynbOeAl8S3xUO6mjKu/Cmt1n/NYEQ2tJE=; b=gDCVoUPSqLdZI5xkj1GTgWEw6XVIuMtiUTNdkfNF8oOwBxq3OGGgchiWDvI2h2omgu v3q9xjIE6D9dWVMrO8DQ1dyj+ClM9clNQSLS4T1UlLG0Nmim4tMWNhWQukEu8te6K813 zWKsvXSI4gwkCLgFY3UaN+pKIo35WRq0yLIRdJp+nTUSXD2EUhvzJVW2IHNkz7EOcog9 koOaw5Zsk9CWn48rpjm9unf16PZL+5xj8AZ4EMUBuK0wLqQJCST3dUlxdmyQ/xXEh+6D o0spbg4o9jYqM3DOZTici5WS+TkH8PCPKuvnJZ58SWcOHyVZ2i0IxaBha1wT7LgIPQkB PE/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=04UdtNaK+8ynbOeAl8S3xUO6mjKu/Cmt1n/NYEQ2tJE=; b=tcRThp0gOWL0e9/VJiqpmbZIi10czTo75ASB+sFZoe7L4ahmkW18NIbEkF+4vF/8JP 9XCDpV3WKbPgR77vr16RPYSwigtH1MlkiMFJYa6WW3/izkv2OGGSwykynLjEh5cF2GXU GVnXuIBhoH+V+YI3R3J3kAfbV8cXwefUoDUGVec6j6YSmdpZ7w8fwO41GUSSjPt7hNEd KntDHXL/iFueyqm6LbDhsljL+X/Con4+ZlODTK672qJKHubINa7olnsyhDvHG3Hl53Y6 lzhOWhzmuhZc/3I9iIclXfQ/UpXDA09K6YZZg8HCbevjEVx4HZ3lsrS7cCiIB6om0S2A YJ6g== X-Gm-Message-State: AN3rC/4mdN2KNSNJttVAwLPqQObypfKOsqxGexCslvHVnnSeE6FrEAL3 21d5TDANNk+1EYKOunVQFy0chEfEZQ== X-Received: by 10.129.91.84 with SMTP id p81mr5401781ywb.82.1492146604404; Thu, 13 Apr 2017 22:10:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.204.83 with HTTP; Thu, 13 Apr 2017 22:10:03 -0700 (PDT) In-Reply-To: References: Date: Fri, 14 Apr 2017 01:10:03 -0400 Message-ID: To: Kelt Dockins Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a114c7b404f1acf054d197442 Subject: Re: [PHP-DEV] rfc concepts From: theanomaly.is@gmail.com (Sherif Ramadan) --001a114c7b404f1acf054d197442 Content-Type: text/plain; charset=UTF-8 There have already been several such proposals made in past years, and discussed at length here on the mailing list. See C# Style Accessors past RFC: https://wiki.php.net/rfc/propertygetsetsyntax-v1.2 and alternatives: https://wiki.php.net/rfc/propertygetsetsyntax-alternative-typehinting-syntax Since PHP 7 already supports scalar type hints and strict mode, as well as magic getters/setters, pretty much all of your aforementioned concepts are already possible in PHP with a bit of boiler plate. The declarative accessors obviously have some benefits like less verbosity and more concise syntax, but we've been down this road before in the past and I'd suggest reading the discussions around those RFCs, with similar ideas, which were declined or withdrawn and coming up with a more constructive approach if you want it to gain any critical mass. It's going to be a tough sell if you just come back with the same approach. On Thu, Apr 13, 2017 at 9:40 PM, Kelt Dockins wrote: > Hi everybody, > > > I've been using php for many years now and it really is a great language. > My friend and I were talking about additional things we would want in php - > sort of like a wishlist. I came up with 3 things that I think would make > php even more awesome and I wanted to share these concepts with this list > and I'd love to get feedback. I haven't done any c programming in years but > I'd be open to working on these concepts if enough people wanted them. > > > > 1. use strict mode > > > ``` > > class Bar { } > > > class Foo > > { > use strict; > > } > > > $bar = new Bar; > > $bar->thing = 1; // no problem > > > $foo = new Foo; > > $foo->thing = 1; // throws error because thing attribute does not > exists > > ``` > > > > 2. type hinting class properties > > > ``` > > class Foo > > { > public $thing : int; > > } > > > $foo = new Foo; > > $foo->thing = 1; // works fine > > $foo->thing = 'string'; // throws Typehint > > ``` > > > 3. auto properties > > > ``` > > class Foo > > { > > private $thing1 { > > get, set > > }; > > > private $thing2 { > > get > > }; > > > private $thing3 { > > set > > }; > > } > > > $foo = new Foo; > > $foo->thing1 = 'asdf'; > > echo $foo->thing1; // echos 'asdf' > > > $foo->thing2 = 'asdf'; // throws error because no setter > > > $foo->thing3 = ''asdf'; // sets thing3 > > echo $foo->thing3; // throws error because no getter > > ``` > > > I'd love to hear what you all have to say about these things. Thanks in > advance for your feedback and time! > > > - Kelt > --001a114c7b404f1acf054d197442--