Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102351 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88215 invoked from network); 21 Jun 2018 16:16:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2018 16:16:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.26 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.26 out2-smtp.messagingengine.com Received: from [66.111.4.26] ([66.111.4.26:47169] helo=out2-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/43-32156-E6FCB2B5 for ; Thu, 21 Jun 2018 12:16:47 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id EE5EC21BD9 for ; Thu, 21 Jun 2018 12:16:43 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Thu, 21 Jun 2018 12:16:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=tczjD95tNNQR4Q9m+Z46iag5F5I8E EX9aRiukOJoLLM=; b=d82xI/UmQNkKHOKgNNOa0ml/DhBMa4dsJkwbgZD5iGj6a c827H56MeXAGyBBVnhr1FVMoeHFiWoRNvGhdhtx1BOR1z7z5YANaBUOSbdMXp+c+ H1J366drkU/0Myf9sKD+XA4vh31vb1G87HGK3sGNKlKLbWYESUyCRSYDLJi4fyvA t8dJYMZR9Hvb7cGd7ivYo9AG/zuEOf56Jry6IoppGHZgKUgDWsUvtOg+Pqs0lTp5 kY6bpmnsTHDC5emtc07nBxSLLlov9ehjLUCQLLjivXprzk0yoGbXRg5nJsqzMtcP TInz+yUnuzeaWIRUIhEnv8n1tK0sB37kEuWhvZ1ww== X-ME-Proxy: X-ME-Sender: Received: from vulcan.localnet (216-80-30-152.s3222.c3-0.frg-cbr1.chi-frg.il.cable.rcncustomer.com [216.80.30.152]) by mail.messagingengine.com (Postfix) with ESMTPA id 8C066E44F1 for ; Thu, 21 Jun 2018 12:16:43 -0400 (EDT) To: internals@lists.php.net Date: Thu, 21 Jun 2018 11:16:38 -0500 Message-ID: <1881440.OZkolYVza1@vulcan> In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1584125.iCuQVEUgLd"; micalg="pgp-sha512"; protocol="application/pgp-signature" Subject: Re: [PHP-DEV] [RFC] Typed Properties From: larry@garfieldtech.com (Larry Garfield) --nextPart1584125.iCuQVEUgLd Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Wednesday, June 20, 2018 4:59:33 PM CDT Nikita Popov wrote: > Hi internals, > > Bob and I would like to present a new typed properties proposal for your > consideration: > > https://wiki.php.net/rfc/typed_properties_v2 > > The proposal allows you to annotate properties with types, which are > enforced at runtime. Unlike the previous RFC on this topic, the new > proposal also supports typed static properties and references to typed > properties. > > Please note that next to the main body, the RFC also contains an > "Alternatives" section, which explores the problem space and considers > trade-offs of different behaviors in some detail. > > Finally, while this RFC currently targets PHP 7.3, this is a large and > complex proposal and we may not be able to meet the deadline, in which case > this feature will go into the next PHP version. > > Regards, > Nikita I am in full squee-mode over this. I'd love to see it, in whichever version is deemed appropriate. (7.3 would be nice, 7.4 would still be acceptable.) Questions along the way: * There was at one point in time a related RFC regarding property accessors (dedicated getter/setter methods for each property that get called automatically). That was rejected largely on performance grounds at the time. Would this RFC 1) Hinder returning to property accessors in the future 2) Help resolve some of the issues there indirectly 3) Have no effect on the viability of accessors? * How much compile time detection is possible? Eg, the following code would clearly never work: class Foo { protected int $val; public function setVal(string $val) : void { $this->val = $val; } public function getVal() : string { return $this->val; } } (I suppose technically it might work in coercive mode, but not strict mode?) Would this be a compile time error, or a runtime error when you first try to run it? (I'm assuming IDE linters would be able to catch it, but if the engine could too that's even better.) --nextPart1584125.iCuQVEUgLd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE/ph/GXfY8v0YwFBp4MMKwDFxYXcFAlsrz2YACgkQ4MMKwDFx YXc34ggAq6D2OuJtk44oaoVfNsCDErnWqtPU0UCz46I+f93rPqaSsdi60VlX035m agDWsHoGu28NBPjXa/7xdfBrFOXAH9orrNewIjTchjwbHix+efa60W/1WgclvRm8 WgPnt8ObTcfdwwn2Sq27qePYB58jp1atWiSTwUK3bfe1r6Q+rQJ/ny93apUDl1yo Tz2c23YSEKURMx1KYlWa7GtUslNAk2WGar3z/cK26eloHDBNZJ/V5k2mJhpx9wFL 4NxfWhXNoZw79g95IcneJ4YGvozJVJz1kpLRJsi5fiJ0Nph4Lf/BkdwnUQaXDkUb vAFQhdoLIaRGksaKdLj/ShXKOn4QHA== =ex9e -----END PGP SIGNATURE----- --nextPart1584125.iCuQVEUgLd--