Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91844 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1773 invoked from network); 22 Mar 2016 13:16:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Mar 2016 13:16:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.49 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wm0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:35094] helo=mail-wm0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CC/C6-46740-BB541F65 for ; Tue, 22 Mar 2016 08:16:44 -0500 Received: by mail-wm0-f49.google.com with SMTP id l68so152437985wml.0 for ; Tue, 22 Mar 2016 06:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=OiAeShdPEqDjhj0bKroONNBcPP0CIQfIUdDaseK2DvA=; b=Ea42XbbNkd3wGbn5Xkl1KBmwHvtp6WzPPUbPM8s8q41C8G1JXbkC5DF/k2J9LSe7DM zyKMpVWasTOOrJo/oFz5+BCNj+hhh4pZ1c4bOQdvBdkaNuSvW2rrAXGMO/KFUYQF0XvW oMK/LRrPticNsw3P4iVf6IiGvmaAyrQYFiKBbhxnEIsPyiAJFjTnmegYTU1RmG/Tndoe ggTzY06770ge4JhboAZzCndbBgF4KdqirfICHIQM+mu1OqizXCVqywesU8jUw8TsWRDv qMz8GSkdWIZyms9LIKOpwi30BcSP7gRReVpurSDOk7R2M2cPQYeZkGP7rNxcTZOQH2Dy /JHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=OiAeShdPEqDjhj0bKroONNBcPP0CIQfIUdDaseK2DvA=; b=fsjkpZyXRDjgrVUgP75BJ8/qgxtLeWJ0m7fnwAie8b1kl57yrPfgCf7tHa+GUAmj+7 fzra4UMLNcJmalxmYQxQs08iwwVcJpUJZr8kcm0nAjrUb5uajFRgNo3t2dewT/fTGFq0 4R9WxXUp9Nto/tghp3vmlO4OcxenxQNqwnUOZ2NIBBR+G1gCHpWEaPHmxnHI1RmDGS8q f/P0azOYJMjOzF0PUzi76MD/eLEwEQhvD+OuINATiVL0KgOOLuq8xXrL7qEox7eDHFIE GDmbYtw+mN7XAXxlU7rq3ON9gkGiFsIN4oIvnIcMEu3gjwI5Cj7yOAVKaT+neaSG/qh4 eC3w== X-Gm-Message-State: AD7BkJJIrCkB6Hyp0AcLLZIskys/2QRNjW5SMtXVULE6iw5vqnDjgyJ6EXdHFLRRCU7l9g== X-Received: by 10.28.13.79 with SMTP id 76mr21193952wmn.5.1458652600101; Tue, 22 Mar 2016 06:16:40 -0700 (PDT) Received: from [192.168.0.82] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id fv6sm30289730wjc.12.2016.03.22.06.16.38 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 22 Mar 2016 06:16:39 -0700 (PDT) To: PHP internals References: <1458149992.3969.2.camel@kuechenschabe> <1458151531.3969.8.camel@kuechenschabe> <1458153695.3969.16.camel@kuechenschabe> <3F.70.02405.6803BE65@pb1.pair.com> <56F01545.8080008@gmail.com> Message-ID: <56F14572.701@gmail.com> Date: Tue, 22 Mar 2016 13:15:30 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties From: rowan.collins@gmail.com (Rowan Collins) Nikita Popov wrote on 21/03/2016 17:05: > While it is no secret that we don't particularly like references, this > is not the reason why they are forbidden. There is no conspiracy to > punish users of references by denying them use of new typing features. > No, the reasons here are technical. Let me illustrate some of the > issues involved in more detail. Thanks for the detailed explanation of the problems, which are indeed deeper than I'd appreciated. To be clear, I never thought it was the intention to dissuade users from using references, but a couple of people have implied that they consider it no bad thing. For me, the restriction on setting references makes this whole feature a no-go for the language as it stands. I don't think it is at all reasonable for the following code to produce a TypeError: class Sorter { private array $data; public function __construct(array $data) { $this->data = $data; sort($this->data); } } new Sorter([1,3,6,5,2,4]); It may be that we've reached the limit of how much typing we can add to the language incrementally, and need actual typed variables, so that references could be made only between variables with the same type hint, e.g. class A { public int $foo=42; } $a = new A; int $ref =& $a->foo; The sort() example would work in this scenario because the expected parameter type is array, so the reference being created is of the matching type. Obviously, this would be a huge change to the language, and no doubt have all sorts of impacts and problems of its own, but I don't think it makes sense to say "you can typehint your property names, but you lose some existing functionality if you do so, for technical reasons". Regards, -- Rowan Collins [IMSoP]