Re: Question about adding !function_identifier

From: Date: Fri, 05 Apr 2019 11:11:56 +0000
Subject: Re: Question about adding !function_identifier
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  Groups: php.internals 
Request: Send a blank email to internals+get-105106@lists.php.net to get a copy of this message
On Fri, 5 Apr 2019 at 11:30, Robert Hickman <robehickman@gmail.com> 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]

« previous php.internals (#105106) next »