Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83634 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11670 invoked from network); 24 Feb 2015 07:15:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Feb 2015 07:15:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.169 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.169 mail-vc0-f169.google.com Received: from [209.85.220.169] ([209.85.220.169:37104] helo=mail-vc0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/50-09240-C252CE45 for ; Tue, 24 Feb 2015 02:15:56 -0500 Received: by mail-vc0-f169.google.com with SMTP id kv19so9327569vcb.0 for ; Mon, 23 Feb 2015 23:15:53 -0800 (PST) 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:date :message-id:subject:from:to:cc:content-type; bh=TIIbDuS9TK5RuiwMVDJd3VGPL0IJFWHkWbjc+zarZGM=; b=gI9W8wQIFmXaWspOt1fZR8uxmvf2Io5opCdBy5//+lx7CPt+FEn1KvMJySfQy1r/NA zll89G3f1bUOCbtTuxSVPd4QdYmyf+/emJ9QKLNI+0mqnEAI5b09rrg3ynQvR0Mzj42I vJ5gh3M9ggzYYtdWja6r6pOe2P05Tbnu8CAidcIWZ5T4dCoyVyU8hSjJE7ZV3CTSYOCA IyMfXUrqBux/G7dyE/E+DqxVroZlUrftBCJsNQDgbY6dHJpMXaCtTfWXYDHI+JQcG52s m/jDlzA0FxpbjYYq9vMuksfBfQCj439bFk32A6qvuaRD3nRGiSFz6KL0SknOeH6B1Jd1 7mgA== X-Gm-Message-State: ALoCoQn18N5yYJ25p0wSGI1M1i+InIMNytpfzOqOjU5PyHT1aObAvcwCuqBTR+83bNqx5e/oQcUWC/WAdOVx8FThu/R931bOGzae5UUrVyzNYPFsIr6xnK5OtCHoWDJU8dXCJemECLr+yFFw85tljsIOZ4ICtDwBMw== MIME-Version: 1.0 X-Received: by 10.52.52.136 with SMTP id t8mr13871178vdo.49.1424762153865; Mon, 23 Feb 2015 23:15:53 -0800 (PST) Received: by 10.52.113.231 with HTTP; Mon, 23 Feb 2015 23:15:53 -0800 (PST) In-Reply-To: <012001d04d46$271dac90$755905b0$@tutteli.ch> References: <011801d04a07$83ab1c00$8b015400$@php.net> <016f01d04a3a$e9183220$bb489660$@php.net> <022801d04ab1$4a0c47d0$de24d770$@php.net> <1913e09d7f52541901d8574d2080a63f@mail.gmail.com> <7a5d96b34b98ec1f3ee17be7fa6a1e81@mail.gmail.com> <2CBDEB67-3DE3-437D-9AF3-0E6A92027244@zend.com> <4cc0c81c7199a452534bb8edcdb19914@mail.gmail.com> <54E589F6.9030002@garfieldtech.com> <54E66569.8000709@garfieldtech.com> <012001d04d46$271dac90$755905b0$@tutteli.ch> Date: Tue, 24 Feb 2015 11:15:53 +0400 Message-ID: To: Robert Stoll Cc: Anthony Ferrara , PHP Internals Content-Type: multipart/alternative; boundary=089e0115f048122d89050fd04a6b Subject: Re: [PHP-DEV] Reviving scalar type hints From: dmitry@zend.com (Dmitry Stogov) --089e0115f048122d89050fd04a6b Content-Type: text/plain; charset=UTF-8 On Fri, Feb 20, 2015 at 10:48 PM, Robert Stoll wrote: > Hi Dmitry and Anthony, > > I was skimming through your conversation about JIT/AOT and that type hints > would allow to optimise few things. > I do not know if you are aware of the following but type hints can be > passed by. Hence neither weak or strict type hints allow to predict the > type (even if only locally): > > function handler($errno, $errstr, $errfile, $errline){ > return true; > } > set_error_handler("handler"); > > class Foo{} > function foo(int $x, Foo $f){ > var_dump($x, $f); > $y = $x; //should be int as well, right? > } > foo(new Foo(), 1); > > Sure, this is something which is hopefully never ever done but anyway, a > language needs to be able to handle all cases. > > right. I know this of course. and this makes type hints useless. > As a side notice, if the exceptions in the engine RFC is accepted, then > this would not be a problem anymore: > https://wiki.php.net/rfc/engine_exceptions_for_php7 > "exceptions in the engine" are going to fix this. Thanks. Dmitry. > > Personally, I would expect that the execution is stopped after the > error_handler was called (after user was able to log etc.) - at least in > strict mode. > > Cheers, > Robert > > > --089e0115f048122d89050fd04a6b--