Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102229 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85890 invoked from network); 11 Jun 2018 14:33:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jun 2018 14:33:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.43 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.43 mail-wm0-f43.google.com Received: from [74.125.82.43] ([74.125.82.43:50378] helo=mail-wm0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/2F-62758-B188E1B5 for ; Mon, 11 Jun 2018 10:33:00 -0400 Received: by mail-wm0-f43.google.com with SMTP id e16-v6so15065625wmd.0 for ; Mon, 11 Jun 2018 07:32:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wwf5eypdu4QIEtia37UwD6P/vM6luExUUHpvppJsOJc=; b=m9dTS8+lPXusYuNfiq3Elqh/G5M/loOeiv0HAaI/AOES0O6hQSGWygzdUKs+qwXf5S nzHEB+F2xy43VixlnDcAtRptDWOV2XfS3LWFquh7v+JMscy3APdQLfPywpvJJIdhPSHK pVUP4H3G5stpDacBGEY7JRLqn6Qb5apbk/4wErMmg8qbzBvQZabvQdnuxAyyJxC7eMv7 4P2MheEvGJ+c4nabLHYOWQ37hL5DLQ16J+yhdf/OSJv/dihrvY5vKhpboTrQVMb0r0qw uqWfXExvtrd2W6Zg+fjDIWW8G0fJr41Kx++ceXsOxq3FK4MPBNW4J9bFw1Wwr8kNvdLs K3/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wwf5eypdu4QIEtia37UwD6P/vM6luExUUHpvppJsOJc=; b=DWYWsHgduLCGE6glI3R08yD84mUIsy7gjPTcnPPmnEDQYW11ZjVXWcUrV9Z/s42Gi/ Ux03diDRn8Dl8DIXiRuuvwPtAfGQSaxN+9UqSF9tdihNYpmCYlGWZYsDegHin9ul9rix tfjCaOFIdq5HtIbHLOJaymvML7ZBSatLEmFjHgX8sO+QqmmUdYjU3oLG0mQSkIH6boQj yEioYuhbvAbqeksT3ftKgGolXWebSwoTOXmuA7TCOmoILmmwba+xReg4NZNq3Oa7h+yc 4G9mJsVzQ8SIU89V7qsvVL5lATtMWi/dzg9Erx9izHl6x4OQACDv3o4e4kvDHuRrNn9v /2kA== X-Gm-Message-State: APt69E15bkYH5VoplzcG1P3m1evZGtmAbvaKcLRUvkFgHwNc8ifi2Ly0 LLOJT7O9lcQKV4XBtCVZ9bqAqKqasQReSUvVBuI= X-Google-Smtp-Source: ADUXVKIDfFbiCDCmu3hawkpJQymP3IHHYA0YWSbOP3VoP3gIvcB+mjRfPrFPXjZXUK4Txy2KAiJZeJZWNp28q15Bjag= X-Received: by 2002:a50:9622:: with SMTP id y31-v6mr3053983eda.32.1528727576894; Mon, 11 Jun 2018 07:32:56 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:8d55:0:0:0:0:0 with HTTP; Mon, 11 Jun 2018 07:32:56 -0700 (PDT) In-Reply-To: References: <0d108361-f5fa-fe76-b6ad-66e23bfa88f5@loot.at> Date: Mon, 11 Jun 2018 15:32:56 +0100 Message-ID: To: Rasmus Schultz Cc: Rudolph Gottesheim , PHP internals Content-Type: multipart/alternative; boundary="0000000000002de1b9056e5ea054" Subject: Re: [PHP-DEV] Better types without runtime checking From: rowan.collins@gmail.com (Rowan Collins) --0000000000002de1b9056e5ea054 Content-Type: text/plain; charset="UTF-8" Hi Rasmus, While I agree with your general point regarding consistency, I just want to take issue with sentence: On 11 June 2018 at 15:12, Rasmus Schultz wrote: > Hack made some very regrettable decisions in this area, and ultimately > those features were useful at design-time only, for IDE-support - but > we have php-doc for that purpose, and in my opinion, adding those > features before (or unless) we're willing/able to also make them work > consistently with the language, does more harm than good. As far as I know, every other language which has added type annotations to a dynamically typed language has done so either using an offline tool (treating them like compiler warnings), or as a debug-only run-time flag (treating them like assertions). The creator of "gradual typing", which is explicitly the basis of Python's type annotations, and at least implicitly used by many other languages, specifically stated that it was intended to be checked at compile-time, not run-time [1]: > A *gradual type checker* is a type checker that checks, at compile-time, for type errors in some parts of a program, but not others, as directed by which parts of the program have been annotated with types. Arguably, it is PHP which made the regrettable decision in adding run-time type hints in the first place. If we removed those, we could implement gradual typing, and maybe add an ability to reflect on the type annotations, without the headache of how this interacts with run-time performance. Nonetheless, we are where we are, so I agree that it would be bad now to add type annotations which did not behave at run-time like the existing ones. [1] http://wphomes.soic.indiana.edu/jsiek/what-is-gradual-typing/ -- Rowan Collins [IMSoP] --0000000000002de1b9056e5ea054--