Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79215 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68625 invoked from network); 27 Nov 2014 07:51:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Nov 2014 07:51:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.50 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.50 mail-pa0-f50.google.com Received: from [209.85.220.50] ([209.85.220.50:58254] helo=mail-pa0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/83-40216-308D6745 for ; Thu, 27 Nov 2014 02:51:31 -0500 Received: by mail-pa0-f50.google.com with SMTP id bj1so4505002pad.23 for ; Wed, 26 Nov 2014 23:51:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=9VKjyRK0lSQyMo6BYZ6EuzRN3xP+GnA9M3bAD/KKB8A=; b=hj8Gracvy9/0XCgMZGYg/hGm1WbbEMoj1eClWdRP5jK5Nz5Hod2DqZ4S5HjvTFR73t vynNd/4s74y02+glRNhtx+jCDKEIBEjLovigkXnR7keKciVZfafg9Mze5W7cjkETclRH Jvvyk1NExGKc2v0+kqZzikVnICXije1AFmYZaTIpmPT9ZWuUqSoH/+4gVBVdD2OLbBDq bxwmS2SliRn/TzoqV/QzkHi/NwaRBEzReoQ/hE72TZf8MhgjTUi6YkqaBJE3sURcQMIf eKiKbjzt2JGHTxr1HQyz0ucGC80FFGq0xKiZQGvLxaW7hEa0usgWzuFqqZEPNPj5LwNJ Du3Q== X-Received: by 10.68.202.104 with SMTP id kh8mr60387177pbc.95.1417074688240; Wed, 26 Nov 2014 23:51:28 -0800 (PST) Received: from stas-air.attlocal.net (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id y3sm6265636pbt.44.2014.11.26.23.51.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Nov 2014 23:51:27 -0800 (PST) Message-ID: <5476D7FD.3020003@gmail.com> Date: Wed, 26 Nov 2014 23:51:25 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: 'Levi Morrison' , 'internals' References: <003701d008da$0c60d630$25228290$@tutteli.ch> In-Reply-To: <003701d008da$0c60d630$25228290$@tutteli.ch> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: AW: [PHP-DEV] [RFC][Discussion] Return Type Variance Checking From: smalyshev@gmail.com (Stanislav Malyshev) Hi! >> I've also used it because it can adequately show the differences in how each of the following options work: >> >> 1. Do covariant return types; check them at definition time >> 2. Do covariant return types; check them at runtime >> 3. Do invariant return types; check them at definition time My opinion is that on some level it doesn't matter too much. The type errors by itself are quite rare among the errors one can make in the program, and usually found and fixed rather easily [1]. Errors in return types - i.e. mismatch between declaration and code in your own code located compactly on the screen - would be even rarer. Errors where the difference is between covariant and invariant classes - and thus use cases where such usage is helpful to prevent them - in my opinion, would be so vanishingly rare that most people would never really need it, and probably would spend much more time figuring out the right types to set on the return values that it will ever save them on debugging. I suspect except for the simplest cases these would be used more for documentation/"feel good" purposes than for anything else. Thus, taken practically, I think the option that has minimal impact on the existing code, its speed and complexity should be taken. If it requires reducing the expressiveness to the option 3, I don't think it is a huge loss. I'm not sure though what is involved in "runtime checking" and what would be the consequences - i.e., what will be checked at runtime and which runtime will it be? In PHP, mostly everything is "runtime" strictly speaking, so some clarification here would help. [1] E.g. check out this one: http://vimeo.com/74354480 There is a vivid debate about many conclusiong derived there but I think empirical evidence is worth considering however is your stand on the conclusions. -- Stas Malyshev smalyshev@gmail.com