Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102183 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68612 invoked from network); 5 Jun 2018 22:18:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2018 22:18:04 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.67 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.67 mail-wm0-f67.google.com Received: from [74.125.82.67] ([74.125.82.67:34080] helo=mail-wm0-f67.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/E4-62758-C1C071B5 for ; Tue, 05 Jun 2018 18:18:04 -0400 Received: by mail-wm0-f67.google.com with SMTP id q4-v6so20581168wmq.1 for ; Tue, 05 Jun 2018 15:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=RzO6aRosz57GGTKeEN/Q0g4lZKenYsKrTQhbPIpfkP8=; b=fRa3D75XRJcwfQIjvFlQykor4czhQkvnpHlCtvRMcfu5cc2WpSHUs6rgnMgOqxxUgt 7MXrfzS8czI68X2ir2aHb0iiqXcxbyVfVS3DkP9xdgKLcHO2N8FPfwrsuqHP1yhsEaNF jEJtoGGlbi0MbZWGZC3b0KGdrjVjJgF+jiqbe7808GejSHTD7chE97HQE/AC5xW7l/1F Cc32Ys+lLNYt04c0pAL86CagRQ7MOPGp7iEtxMAth0n1xuHJAEj0+gXgTNms/iAOS1u0 5If5jyPC/7Xcbo9ty/4MPHyu0AVroZwATD0j+mNBqWRXlbUD5IPS0c0RyhNIW9pc2GW2 vL6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=RzO6aRosz57GGTKeEN/Q0g4lZKenYsKrTQhbPIpfkP8=; b=s+GQhOeY4KYkI1XQKAW9hpeuQFH70YzWZTv2NiyBU/PIXsavPWqtMDU4dLSTN/XTcf DVXO/vts9dvkXPtr47GG2o6guj4q90tznjaof3oxlVyFm5ahdEeYcJAHzOPOAH466IrL aaV6ldvYzcN59LMZZ0HqRsnFmMMNleugLVSTHSSzSS00A/mgMQ4zlC3FEiVcoE/t6yb4 3d8X3ydnbR3FQcOvePVGFn6onEA0XVU9ExIiT6phgsxUgT44PESQggRQSMz390Cpsv8A XRy8njjCUfIAgd1M5QvuW3I5Yzfszn+KvAFdQgzZYTl4VAtCy/lQ1YYm9E0UfpzarGE0 e1kg== X-Gm-Message-State: APt69E2FsSq+klimHnUNii0JwL3GIUvwfLFCRPhpkaiUk9cXtlSHwc0o /BKG3W3L749yyUxVVmQeW2t+9O0o X-Google-Smtp-Source: ADUXVKKGL+CP7PY7G5g9DZ+5QtpfJ3H94kObdEILIKk4k8CaTjq8CTYUbj+ehH9Dm10bTxXuOSkCPA== X-Received: by 2002:a1c:c342:: with SMTP id t63-v6mr35883wmf.123.1528237081104; Tue, 05 Jun 2018 15:18:01 -0700 (PDT) Received: from ?IPv6:2a00:23c4:4b86:4b00:bc65:81f9:1a34:f65? ([2a00:23c4:4b86:4b00:bc65:81f9:1a34:f65]) by smtp.googlemail.com with ESMTPSA id 135-v6sm3659066wmx.21.2018.06.05.15.17.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jun 2018 15:18:00 -0700 (PDT) To: internals@lists.php.net References: <0d108361-f5fa-fe76-b6ad-66e23bfa88f5@loot.at> Message-ID: <3c36b189-108d-bce7-bea0-7a3d6a432607@gmail.com> Date: Tue, 5 Jun 2018 23:17:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <0d108361-f5fa-fe76-b6ad-66e23bfa88f5@loot.at> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [PHP-DEV] Better types without runtime checking From: rowan.collins@gmail.com (Rowan Collins) On 05/06/2018 08:22, Rudolph Gottesheim wrote: > There's always a lot of talk about types in the PHP community. > Specifically, many developers want property types, generics, function > signature types, union and intersection types, and more. Those talks > (and RFCs) always end with the same result: "We can't do it because > performance issues." > > Has there ever been a discussion about adding some of those features > syntactically, but ignoring them during runtime? At least until > someone finds a performant way to check them at runtime. That way we > could have advanced type checking in our editors at least. Hi, I believe this is part of the original aim of Hack-Lang: the additional type features of that language are not part of the run-time, but checked by a static analysis tool offline. A number of languages have similar setups - Python and Dart both have the types as offline and/or development-mode-only features. Indeed, PHP seems to have gone a very unusual route in having a dynamic language with type constraints which are effectively always-on assertions. One of the problems with moving PHP to this offline-checking model is that people will expect new type constraints to work like existing ones, so may be caught out by them not being checked at run-time. Worse, static checks may not be able to detect certain violations; I don't know much about Hack's model, but I understand it includes both different levels of strictness, and restrictions on dynamic language features - things like references, "variable variables", and non-object callables. I do think it's an interesting question to think about though. Regards, -- Rowan Collins [IMSoP]