Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102241 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74818 invoked from network); 12 Jun 2018 22:43:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jun 2018 22:43:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ohgaki.net designates 180.42.98.130 as permitted sender) X-PHP-List-Original-Sender: yohgaki@ohgaki.net X-Host-Fingerprint: 180.42.98.130 ns1.es-i.jp Received: from [180.42.98.130] ([180.42.98.130:48394] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/E5-27729-37C402B5 for ; Tue, 12 Jun 2018 18:43:00 -0400 Received: (qmail 114856 invoked by uid 89); 12 Jun 2018 22:42:55 -0000 Received: from unknown (HELO mail-it0-f41.google.com) (yohgaki@ohgaki.net@209.85.214.41) by 0 with ESMTPA; 12 Jun 2018 22:42:55 -0000 Received: by mail-it0-f41.google.com with SMTP id j135-v6so1460447itj.1 for ; Tue, 12 Jun 2018 15:42:54 -0700 (PDT) X-Gm-Message-State: APt69E10H1nR647DQ49ciRb3dR7PyjpZLtDoyZLHrGuLDKjXcIcsXgpS iGXzAGXOkxEznMBOMd+uG2QESe36SWTmlMWwEA== X-Google-Smtp-Source: ADUXVKJaN4NTJmApw12vO3mJ0AriUju2eWW/iq6Op9IzFcDKD68pveeh+Rij/rLY7RxWXlEpS46g6zI+I8BrVcxsZso= X-Received: by 2002:a24:37d4:: with SMTP id r203-v6mr2406488itr.126.1528843369006; Tue, 12 Jun 2018 15:42:49 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:908e:0:0:0:0:0 with HTTP; Tue, 12 Jun 2018 15:42:08 -0700 (PDT) In-Reply-To: References: <0d108361-f5fa-fe76-b6ad-66e23bfa88f5@loot.at> Date: Wed, 13 Jun 2018 07:42:08 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Rowan Collins Cc: Rasmus Schultz , Rudolph Gottesheim , PHP internals Content-Type: multipart/alternative; boundary="000000000000ed4f7a056e79958f" Subject: Re: [PHP-DEV] Better types without runtime checking From: yohgaki@ohgaki.net (Yasuo Ohgaki) --000000000000ed4f7a056e79958f Content-Type: text/plain; charset="UTF-8" On Mon, Jun 11, 2018 at 11:32 PM, Rowan Collins wrote: > 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]: > Making "type hint" a "true type hint" is useful with DbC as well as static analysis tools. Perhaps, declare(strict_types=-1); // -1 indicates assert() type check. i.e. asset is disabled, no type checks. How it should behave with object would be debatable. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --000000000000ed4f7a056e79958f--