Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14892 invoked from network); 16 Apr 2016 01:12:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Apr 2016 01:12:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=cornelius.howl@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cornelius.howl@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.53 as permitted sender) X-PHP-List-Original-Sender: cornelius.howl@gmail.com X-Host-Fingerprint: 209.85.218.53 mail-oi0-f53.google.com Received: from [209.85.218.53] ([209.85.218.53:34855] helo=mail-oi0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/4E-29891-67191175 for ; Fri, 15 Apr 2016 21:12:22 -0400 Received: by mail-oi0-f53.google.com with SMTP id p188so140029085oih.2 for ; Fri, 15 Apr 2016 18:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=nDPHJyTC4hOmfe9Jqi/sABKFt8Y4UsyKXs/ceiyzBms=; b=YaBKFfbvVEr1vSUaPmPOexOM55enUUmaiUl2xgf8xJlP4pHok/ebqa/JRp/7E5Ixqj z4dtmcSkoGtnwZvHbCfHj+m7CNhK0Qr5zKmARFbU2gpofN+opNScvpAsbIPOfWAnoYO7 L//FlSn3ursYE6NLFaQUVJtH6qeghyoCdPOaPfCIsuPujv+3DfVPyj6ZvMC5iMnUx/Ye KITEvgy6Sm9YGkkd2wxgE05FMyayz8DsaJKEPmcetbd7Es3NH8czZESaL9ZLAaELjm0r vkraRsue6i5DFygiGM0XKr0mIErSFg2VcRzDdW7hOykJcWDopWRVxLZeJGKRpj2xz2vu OaBg== 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; bh=nDPHJyTC4hOmfe9Jqi/sABKFt8Y4UsyKXs/ceiyzBms=; b=dmGdr9Uj7MAPCYhD+P932o5svmhWhY+KeS6cxFae19DxDuTh+ZrtSnoeQWmNzmmV0z 45AOuojIE6cBX4w8u45/ve2hmtA9qM9ywXCu36XO9I+kNweeggp3YKTqwea0O6jxGZY9 8I0AQMhEVmMSrbLujCcPpD0JyivChstLLRKrzUvYNAMDPxOot5p8Scy/dxB4yetJ6SsE VOh5PNFftwxmk9uqYyycdfF2174K7by50CMc4ZS2aBh3iYEzkqjB1TQ3bUNNe7E59FPI sKdSP6d0AAZcU8Wryu6iRRdX/6otbGBxLrWfyGLAQ353f2E0kenhba6ZSiHE+jLR0FEf OFAQ== X-Gm-Message-State: AOPr4FWndPjAmQT6Liw1QTBmX0Tn3LWMdg7osdDp9cESaQlgkYitJvT6uW3HJkVto+I8ua4assH2PnjhyH141A== MIME-Version: 1.0 X-Received: by 10.157.47.165 with SMTP id r34mr12662183otb.15.1460769139667; Fri, 15 Apr 2016 18:12:19 -0700 (PDT) Received: by 10.157.7.194 with HTTP; Fri, 15 Apr 2016 18:12:19 -0700 (PDT) In-Reply-To: References: <570E99AC.3090804@fleshgrinder.com> <570EA5EB.8090501@fleshgrinder.com> <570EAB0D.6080706@gmail.com> <570EB67E.8010908@garfieldtech.com> <5B147E88-CC0A-4CBC-A49D-C7FE3BF557C0@zend.com> <6F.C3.12455.94C5F075@pb1.pair.com> <20160414094440.GF19347@phcomp.co.uk> <570FD94F.90703@fleshgrinder.com> <570FE8A9.4020809@gmail.com> <20.53.29891.17401175@pb1.pair.com> <57110BCD.5030009@garfieldtech.com> <571124C2.9040606@gmx.de> <57112F31.8070209@garfieldtech.com> Date: Sat, 16 Apr 2016 09:12:19 +0800 Message-ID: To: Larry Garfield Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a113e2fccab425e05308fd136 Subject: Re: [PHP-DEV] Re: Improving PHP's type system From: cornelius.howl@gmail.com (Lin Yo-An) --001a113e2fccab425e05308fd136 Content-Type: text/plain; charset=UTF-8 If we can pre-define the types via something like this: data Tree a = Branch (Tree a) (Tree a) | Leaf a And only allow one type for each function parameter in the prototype, then, I think the performance impact of type checking in the runtime can be reduced. In other words, you predefine the union type before you used them, and the union types can be reused in different functions, you don't write a lot union type in function prototype. For example, typedef T = array | Traversable function foo(T $a) { } function bar(T $b) { } --001a113e2fccab425e05308fd136--