Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83497 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70704 invoked from network); 22 Feb 2015 22:28:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Feb 2015 22:28:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:64087] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DC/59-18531-1085AE45 for ; Sun, 22 Feb 2015 17:28:18 -0500 Received: from moorea (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTP id ADF674B0175; Sun, 22 Feb 2015 23:28:05 +0100 (CET) Reply-To: To: "'Stanislav Malyshev'" , "'Zeev Suraski'" Cc: "'PHP internals'" References: <7ef509ef10bb345c792f9d259c7a3fbb@mail.gmail.com> <8250289916f5128b5bc1a114428d374e@mail.gmail.com> <54E9E6B5.3030905@gmail.com> <54EA3E59.3000706@gmail.com> In-Reply-To: <54EA3E59.3000706@gmail.com> Date: Sun, 22 Feb 2015 23:28:13 +0100 Message-ID: <06ba01d04eee$d8f37040$8ada50c0$@php.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQKcPg+jpyYspJS11b5G1A7RBHpKTgFW66vOANg4ZZIBOJUt6QGCFVBlAiJGOPgC0eEvmJsWbtrg Content-Language: fr X-Antivirus: avast! (VPS 150222-1, 22/02/2015), Outbound message X-Antivirus-Status: Clean Subject: RE: [PHP-DEV] Coercive Scalar Type Hints RFC From: francois@php.net (=?utf-8?Q?Fran=C3=A7ois_Laupretre?=) Hi Stas, It seems the actual problem is that we have too many compiler / code = analysis experts in the community ;) (don't get me wrong, I am not saying that for you, I just admire your = patience explaining the same again and again to people who never read = one line from PHP core source). Regards Fran=C3=A7ois > -----Message d'origine----- > De : Stanislav Malyshev [mailto:smalyshev@gmail.com] > Envoy=C3=A9 : dimanche 22 f=C3=A9vrier 2015 21:39 > =C3=80 : Jefferson Gonzalez; Etienne Kneuss; Anthony Ferrara; Zeev = Suraski > Cc : PHP internals > Objet : Re: [PHP-DEV] Coercive Scalar Type Hints RFC >=20 > Hi! >=20 > > A JIT or AOT machine code generator IMHO will never have a decent = use of > > system resources without some sort of strong/strict typed rules, > > somebody explain if thats not the case. >=20 > Yes, that's not the case, at least nobody ever showed that to be the > case. In general, as JS example (among many others) shows, it is > completely possible to have JIT without strict typing. In particular, > coercive typing provides as much information as strict typing about > variable type after passing the function boundary - the only = difference > is what happens _at_ the boundary and how the engine behaves when the > types do not match, but I do not see where big performance difference > would come from - the only possibility for different behavior would be > if your app requires constant type juggling (checks are needed in = strict > mode anyway, since variables are not typed) - but in this case in = strict > mode you'd have to do manual type conversions, which aren't in any way > faster than engine type conversions. > So the case for JIT being somehow better with strict typing so far > remains a myth without any substantiation. >=20 > > while on strict mode the generated code could be: > > > > int calc(int val1, int val2) { > > return val1 + val2; > > } >=20 > No, it can't be (at least it can't be the _entire_ code of this > function), since the user still can pass non-int into this function - > nothing introducing strict typing in functions, as it is proposed now, > prevents it. What strict typing does is to ensure the error in this > case, but to generate the error you still need the checks! > BTW, your weak mode code is wrong too - there's no need to generate > Variants if you typed the variables as int. You know once coercion is > done they are ints. At least in the model that was now proposed. >=20 > > If my example is right it means strict would be better to achieve = good >=20 > Unfortunately, your example is not right. >=20 > > to another level of integration with PHP and performance. IMHO is = harder > > and more resource hungry to implement a JIT/AOT using weak mode. = With >=20 > Please provide a substantiation for this opinion. So far what was > provided was not correct. >=20 > > Thats all that comes to mind now, and while many people doesn't care = for > > performance, IMHO a programming language mainly targeted for the web > > should have some caring on this department. >=20 > Please do not strawman. A lot of people here care about performance, = and > you have not yet made case that strict typing has any benefit on > performance, so implying that opponents of strict typing somehow don't > care about performance while you champion it does not match the real > situation. > -- > Stas Malyshev > smalyshev@gmail.com >=20 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php