Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58067 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74114 invoked from network); 25 Feb 2012 20:27:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2012 20:27:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=samuel.deal@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=samuel.deal@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: samuel.deal@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:50878] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/B3-46034-724494F4 for ; Sat, 25 Feb 2012 15:27:20 -0500 Received: by qcmt36 with SMTP id t36so140521qcm.29 for ; Sat, 25 Feb 2012 12:27:16 -0800 (PST) Received-SPF: pass (google.com: domain of samuel.deal@gmail.com designates 10.224.31.18 as permitted sender) client-ip=10.224.31.18; Authentication-Results: mr.google.com; spf=pass (google.com: domain of samuel.deal@gmail.com designates 10.224.31.18 as permitted sender) smtp.mail=samuel.deal@gmail.com; dkim=pass header.i=samuel.deal@gmail.com Received: from mr.google.com ([10.224.31.18]) by 10.224.31.18 with SMTP id w18mr4084261qac.44.1330201636939 (num_hops = 1); Sat, 25 Feb 2012 12:27:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=h7cQjZDZsjOhsW8d/noeBmC61BrbcnMSyPkEd3utHrE=; b=DRf0PBDU+UPZgVCnWQBJr823as+s1rhMBlU3PZ2fJ11mmhkldR1oL7t7gPhbk47Mag RvxVqltw7PeLZ/I1WrAOW1iq6DdF3EbZxb0/xf/peq/d+d3ljDQ0w23nFvE7IwMZKtm+ pQNjvu1oKdlQNmllMTVgO46AKG7xuu7iPUmb0= MIME-Version: 1.0 Received: by 10.224.31.18 with SMTP id w18mr3484113qac.44.1330201636863; Sat, 25 Feb 2012 12:27:16 -0800 (PST) Received: by 10.229.220.84 with HTTP; Sat, 25 Feb 2012 12:27:16 -0800 (PST) In-Reply-To: References: <4F455C96.50706@gmail.com> <4F455E91.2060408@alliantinternet.com> <028001ccf1ab$0b200050$216000f0$@alliantinternet.com> <4F457517.7050901@alliantinternet.com> <028d01ccf230$91d79b00$b586d100$@alliantinternet.com> <4F4686C6.2040207@sugarcrm.com> Date: Sat, 25 Feb 2012 21:27:16 +0100 Message-ID: To: Kris Craig Cc: Richard Lynch , John LeSueur , Stas Malyshev , Anthony Ferrara , Dmitri Snytkine , Sebastian Krebs , PHP internals list Content-Type: multipart/alternative; boundary=20cf3074b4620b7efe04b9cfb428 Subject: Re: [PHP-DEV] [RFC] Enum proposal (yet another) From: samuel.deal@gmail.com (Samuel Deal) --20cf3074b4620b7efe04b9cfb428 Content-Type: text/plain; charset=UTF-8 Hi, Going to Strict tying it's really a major paradign shift. To clarify my talk, When I say "strict typing", I'm talking about strict scalar check, variable definition or return type check. I'm ok with weak scalar type hinting. We have type hinting, yes, but it's a kind of syntaxtic sugar for : if(! arg1 instanceof MyClass){ throw new exception("How are you using my work ?!!"); } Any check we make slow our execution time. Before type hinting exists, we performed manualy this check, and it was verbose and slower than same check done by PHP native code. PHP is a script language. No compilation pass. In all cases, because someone made a bad use of a function, it will break at execution time. So type hinting and strict typing will not make our code safer or faster. We don't have to be ashamed of using a script language. Thanks to this, we can do metaprogramming. for instance, __call() allow us to do really awesome things If we look at other script languages, Python, Ruby, Perl or Javascript doesn't have srtict typing nor type hinting. I love static languages. I write code in C, C++, Java, As3 and C#. They have good performance, stric typing, static checks at compilation time. But it's a different technology, and their philosophy is allowed only because there's a compilation phase. That's why when facebook, with HHVM, tryied to make a faster PHP, it can only work with a subset of what is realy PHP. For this reason, it's really really difficult to make javascript a fast language (v8 and sipermonkey are very complex). For the same reason, now Adobe decide to give up with the dynamic part of ActionScript (wich was limited compared to PHP) to speed up their VM. So I think going to scrict typing only make sense if we want a static language, with compilation phase and performances gains due. But it would be more than a major compatibility. A lot of things will be not only be broken, but will be impossible. Finally, it would be a so big engine change that it would be better to restart the engine from scratch. And if we start from scratch without backward compatibility, is this still PHP ? And is there a language which already works as expected? Java ? Just my 0.02$ -- Samuel DEAL samuel.deal@gmail.com --20cf3074b4620b7efe04b9cfb428--