Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102188 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5072 invoked from network); 6 Jun 2018 06:14:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jun 2018 06:14:48 -0000 Authentication-Results: pb1.pair.com header.from=ryan.jentzsch@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ryan.jentzsch@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.66 as permitted sender) X-PHP-List-Original-Sender: ryan.jentzsch@gmail.com X-Host-Fingerprint: 209.85.214.66 mail-it0-f66.google.com Received: from [209.85.214.66] ([209.85.214.66:53981] helo=mail-it0-f66.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/08-62758-6DB771B5 for ; Wed, 06 Jun 2018 02:14:47 -0400 Received: by mail-it0-f66.google.com with SMTP id a195-v6so6602422itd.3 for ; Tue, 05 Jun 2018 23:14:46 -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=WbPReCa6c8xed6YvMhZOakDldQvEcLxIPuesvtXYts8=; b=NDp4AKRPFNq7zJE+3Q+JNV+QPotcXd7+koCbWg2llR8u0R7+6IqibxcNxC98BHqoQW 4eZ6By7kRUApoYx67Muo0522L2k14pYkMuD9BYnwIH1Z3aBxfRgsRnq6GiYPtnYw/9NT uML6KrChqaAkO4KU09x5gOSXnyqoC8ijNMCW5yAb/BOgkoDshiakNmLlKPw0kuLjLO20 /8B/SezdndCP/aQivSJ64rYxGbcd9UT9IcoigSIwPQ0zydzv9WwkqDQdh39Ik2m/80HQ zByBk7Bq6/USfkPtxasBQ0nNtCiKlyM9o4fwbOux2RGP1YrTKphcBZJRXuQPPa9LIjFx VuVQ== 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=WbPReCa6c8xed6YvMhZOakDldQvEcLxIPuesvtXYts8=; b=gufZWWHi4xsRfbaDTLPdg4i2/raNnYoKN+CBSIJo0B4PfeTZZGsXqNHGS2ouazyfVC cf/62+WjS1naAjN5XSEI1tr7RfAJrOyGx80gNiTURqDlgBSqj1ums2LAUy28odj5NBqs ZpLr2iLXZ4LDJXRFGXIYJZDiOGk+p12keeHEzm6xgGqxk0Vx1ZhkxlFtVhIWEmx02d2o JPuxtec4AR9ViSNzKI911krGORcq7snPqNTT1G4jBu1Ljw4MXsCqi1A0oC7Eff+MUBYd mmFzLToxOfNRtKFr8KrQPPXpCMJM7ZKeDkOHyHagkf12l7xzTVu0NWiGlao0+c4VEF/f ZO8Q== X-Gm-Message-State: APt69E1dn+4JgFkylzeMSykySuS1IA2y8tmAV0XHa0yOwLW0v7eAzT0Z mveof/mfGppDk4mpuBRgUXk8jPdllvwi/PQK6qg= X-Google-Smtp-Source: ADUXVKLAaTn+mmweUapHeb4yxUpj0CZGtWNFQENepZzzIydP0FBDjdahAZiKyGUrBaGSnaTSZ5jh+XGnb2yvVGAcTlo= X-Received: by 2002:a24:ac44:: with SMTP id m4-v6mr1265655iti.136.1528265684276; Tue, 05 Jun 2018 23:14:44 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bfc4:0:0:0:0:0 with HTTP; Tue, 5 Jun 2018 23:14:13 -0700 (PDT) In-Reply-To: <3c36b189-108d-bce7-bea0-7a3d6a432607@gmail.com> References: <0d108361-f5fa-fe76-b6ad-66e23bfa88f5@loot.at> <3c36b189-108d-bce7-bea0-7a3d6a432607@gmail.com> Date: Wed, 6 Jun 2018 00:14:13 -0600 Message-ID: To: Rowan Collins Cc: Internals Content-Type: multipart/alternative; boundary="0000000000003bdce9056df3157e" Subject: Re: [PHP-DEV] Better types without runtime checking From: ryan.jentzsch@gmail.com (Ryan Jentzsch) --0000000000003bdce9056df3157e Content-Type: text/plain; charset="UTF-8" Why would something like this not work? strict class MyClass { protected int $foo = 1; public string $bar = "strict keyword in front of class allows/enforces strict properties"; private string $isItReallyThatDifficult = "to implement this?"; } On Tue, Jun 5, 2018 at 4:17 PM, Rowan Collins wrote: > 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] > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --0000000000003bdce9056df3157e--