Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105106 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 2115 invoked from network); 5 Apr 2019 14:16:16 -0000 Received: from unknown (HELO mail-it1-f181.google.com) (209.85.166.181) by pb1.pair.com with SMTP; 5 Apr 2019 14:16:16 -0000 Received: by mail-it1-f181.google.com with SMTP id q14so8802163itk.0 for ; Fri, 05 Apr 2019 04:12:08 -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; bh=t3F6Ws4d7X9M5b9/q1vgDHQYlj5LS4XWTFkxfueHWAs=; b=eT8rOUvlSo3t6+O7L5KuLozx3V7oyRJMZdV0XuIsaGWR7K6VFub+f2lwFGf7CWo8EB 5MKHbNcNFJjBi4MSF6AQFE3Z53cdNCxaX47G7l4QESbXfgs/gLuiSiCjttJcluI9oRQ/ 877TksitwAlFqcgsBU/RkXaH9RieGckL6D4KHfksPwcr6sMUIv97Zr3OrtTREsQ9WR27 1EYBGAtzmLnVRuKwVVERPtlbW9y+2SNZjc0kQIfYQxyYFjo2s15WqKbGy2iOOawhWeHQ D06+DUg2do05cvfPbzqXghqVxK5sEVEseR/WZBA/xgUFOinMN3rtv1ccTYV2PIFFKUiW d+kA== 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; bh=t3F6Ws4d7X9M5b9/q1vgDHQYlj5LS4XWTFkxfueHWAs=; b=e4S8/lyCZmQDb4Lx3dBkPVsEtHQ2YzzEjwuE87IHhPfsaWV0VtyMnqMFgR9ttoxem8 dwGDV6JgWrzos4XQ+IXXv8TUcLk+qACIpL9D1NdQyM2u02Fzh/kjL8Ax0CJb7l9EJqFy Tgyikkgbs1suQfhPMkh7aT/+qKMbUxYovTyV6FpQI8P5vETdlFRwEwCsrAWAGtiSQYMv EXk9mgdk3nj6RCrwdyQv+1yl8FEIW3Pap00U4cMJ3KtXI/nqotAlr1GVmSi7fCfXd4+I O0kk7XiCi1pC+bAed7POc7sAZBGqa3CFmyJlK0AX0hJV7AAT57xlOT7HKeoAV37XFAv6 dUvw== X-Gm-Message-State: APjAAAVsgwBo84IXDikei4cWBeHg+2pxtvQ5wVo++pi0Lyc8f10eci54 YVOjEiVuPvLtzN88tvktCZhlSf+4GMttdt5FYZdMM7WA X-Google-Smtp-Source: APXvYqxDVqCQY2lYkNIDXPKaCscII3b/Ja9GGjSLX3J+WFfmRxtSTsmLmiwqVir/7XRxCnB5p+qnR3yRTv9fCKAy5vo= X-Received: by 2002:a02:3506:: with SMTP id k6mr8932300jaa.41.1554462728199; Fri, 05 Apr 2019 04:12:08 -0700 (PDT) MIME-Version: 1.0 References: <65AF9E1E-DFA6-47AE-952B-9ABEBD9B6038@gmail.com> <284d1f9f-03d3-1488-77dd-82e18edf9f4c@gmail.com> <3144F5D1-1F18-4C42-9B3E-AF1B1E598E47@koalephant.com> <917cb7bc-4abc-4bae-1a5a-b2ba1777fa55@gmail.com> In-Reply-To: Date: Fri, 5 Apr 2019 12:11:56 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000bb20590585c68ee9" Subject: Re: [PHP-DEV] Question about adding !function_identifier From: rowan.collins@gmail.com (Rowan Collins) --000000000000bb20590585c68ee9 Content-Type: text/plain; charset="UTF-8" On Fri, 5 Apr 2019 at 11:30, Robert Hickman wrote: > If a static > analyser were programmable, it could parse the SQL query and query the > database to find out what keys exist in some_table. Thus it could > check for references to non-existing keys. > That's an interesting example, but I don't think it generalises as far as you think: what would a "programmable analyser" do with an array of HTTP headers, or query-string parameters? However, I wasn't referring to dynamic *data* like this, but rather dynamic behaviour in the language itself. A couple of simple examples: function foo(callable $bar): int { return $bar(); } function foo(iterable $bar): int { foreach ( $bar as $baz ) { return $baz; } } In order to analyse those, you need a) the language to offer a richer type system (generics, derived types, etc); and b) the programmer to make full use of that type system, everywhere. As soon as you have code that's missing rich type information, or use a truly dynamic feature, that whole section of code becomes essentially unchecked. That's why Hack is not only adding features for richer (statically analysed) type annotations, but also *removing* PHP features which don't work nicely with them. Regards, -- Rowan Collins [IMSoP] --000000000000bb20590585c68ee9--