Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111885 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 3073 invoked from network); 17 Sep 2020 16:12:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Sep 2020 16:12:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C9DF618050B for ; Thu, 17 Sep 2020 08:21:26 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 17 Sep 2020 08:21:26 -0700 (PDT) Received: by mail-ua1-f44.google.com with SMTP id d18so813776uav.4 for ; Thu, 17 Sep 2020 08:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=R7qy21Nsg+BcqhekAES5IbayBoq2QpqMseA9OhFp7bE=; b=n3L908ehYWUiDyEQ194puLTTLxelx3npWMlx1N4nfEm366MsbB8PLabQtOjNBtnPny 4wZZ+E665a9CS1VCaoovi9VHe/CV6E/oj2MtP8Aa3LZMsxWN3xNVW4f+RJzdGO66TcOt c4/uMWBws8V7mSy+GfE4A+dMedFddaECPS1FN5S7A9w7fweVdiw59bAx55vHnvOpgUT0 2+F/xjiG0XcbJ2gDDK1pt2Hs3X5Hb0Z3L/eGBjiT8q10ycacfyQfM+N5zj4DRhp1fcqe Wy3nUq5ZAZdmrwsilsC5IFEWF5Gf79fA9Jqn24BTXq5pu8VQFcioW9C3rrk/Y6vUlJxn s0vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=R7qy21Nsg+BcqhekAES5IbayBoq2QpqMseA9OhFp7bE=; b=eelIZHJAlQ1IMF1IaNyLGkmgQKVJ/jcUs/DIT67dFdeoaQZrdG5h3RyaB0hndErBrZ nRMx7WZT4CBc9b7LO6LwBxUqesnPLrCKPk5m6u516/5WdoCd7nnLnXrDgyNiw75vxsnK NfH/osaAhC27Bs9xj+GQMz6VWrnDxkR3WHk6+YTI9zQ5/V3hLj3Uz3giPk5wIxTXkUUB 1rSyKnCCynNKS+AQcjjXAUENANwTDQA8dma13uwubP/Z/ch280AYgIwQwXc0YBIdo/ft N5hiDAk2VmTA7hUQUxH+y2F2cI0wETykhoTX9nnbJP/jAiKaf62kQWNEutlN0/RoBwDw RHTw== X-Gm-Message-State: AOAM532QuXmtmKDjuOZQTBYuPaqLawbF0O07H6vuhTpIz7+51+TIyk76 LhZIATp1/09ru9RnGojKPsFAA5ZqZ3iG4d26j2oFCQRNlgFZ/g== X-Google-Smtp-Source: ABdhPJx7fEyXuhPTbkFtW0dFMh65qU988elx4e3i+6GwQG37JAH0Kq9GZ1Yij9S81YmxeAKzOxRpPT8hrLVgxdTxtJ4= X-Received: by 2002:ab0:3727:: with SMTP id s7mr15026678uag.119.1600356083241; Thu, 17 Sep 2020 08:21:23 -0700 (PDT) MIME-Version: 1.0 References: <09DE673B-71B7-4C8E-A795-900B51F8E476@stitcher.io> In-Reply-To: <09DE673B-71B7-4C8E-A795-900B51F8E476@stitcher.io> Date: Thu, 17 Sep 2020 11:21:12 -0400 Message-ID: To: Brent Roose Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000db181105af83ef11" Subject: Re: [PHP-DEV] The case for transpiled generics From: matthewmatthew@gmail.com (Matthew Brown) --000000000000db181105af83ef11 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Quick thing before I get into my own reaction: Transpiling is normally thought of as the process of converting one language into another. Tools like Babel transpile TypeScript to JavaScript. What's being proposed here (AFAICT) is type erasure =E2=80=93 the generic t= ype information would be erased during the conversion to opcodes. Python (the language) has type erasure for all its types (including its generic types), so no popular Python interpreters check that a function call's argument types match up with the function signature. PHP currently does not erase any types so the opcodes generated by PHP's interpreter include type checks for all the arguments passed to a typed function signature. Hack follows PHP's model, but erases generic types by default (though has more recently introduced the concept of reified generics) in much the same way you're proposing. --000000000000db181105af83ef11--