[PHP-DEV] Re: A Hacker's Guide - Obsolete

2020-01-24 Thread Christoph M. Becker
On 23.01.2020 at 13:07, Daniel Martín Spiridione wrote: > Hi interns. The official PHP.net documentation of the "PHP at the Core: A > Hacker's Guide" section (https://www.php.net/manual/en/internals2.php) is > obsolete. > > In that sense Python has good documentation to be extended in C / C ++. I

[PHP-DEV] Add viable long running execution model to php 8

2020-01-24 Thread Robert Hickman
PHP is pretty unusual in comparison to most web platforms nowadays as it runs each request in an isolated process. Web development in other languages is instead based around a long lived set of processes, which serve multiple requests. That model has advantages in that it is very easy to cache dat

Re: [PHP-DEV] [RFC] Adding a "Stringable" interface to PHP 8

2020-01-24 Thread Nicolas Grekas
Le mer. 22 janv. 2020 à 20:03, Rowan Tommins a écrit : > On Wed, 22 Jan 2020 at 15:47, Nicolas Grekas > > wrote: > > > Hello everyone, > > > > as announced last week, I'm officially opening a discussion for adding a > > "Stringable" interface to PHP 8. > > > > The RFC and its rationale are prese

Re: [PHP-DEV] Re: [RFC] "use global functions/consts" statement

2020-01-24 Thread Nikita Popov
On Sat, Jan 18, 2020 at 11:53 PM tyson andre wrote: > > I'd much rather have something like: > > > > declare(ambiguous_element_lookup=0) > > > > declare(ambiguous_element_lookup=off) > > Aside: declare(unambiguous_element_lookup=1) is probably a better choice > than my first choice of (disable_am

Re: [PHP-DEV] Re: [RFC] "use global functions/consts" statement

2020-01-24 Thread Nicolas Grekas
> One option that I haven't seem much discussion on is the opposite: Always > only look in the global namespace. Any unimported unqualified usages will > be treated as fully qualified names. This would match the proposed > semantics for functions/consts and change the resolution rules for classes.

Re: [PHP-DEV] Re: [RFC] "use global functions/consts" statement

2020-01-24 Thread tyson andre
> > One option that I haven't seem much discussion on is the opposite: Always > only look in the global namespace. Any unimported unqualified usages will > > be treated as fully qualified names. This would match the proposed > > semantics for functions/consts and change the resolution rules for cla

Re: [PHP-DEV] Re: [RFC] "use global functions/consts" statement

2020-01-24 Thread tyson andre
> I like the idea of using a meaningful value here, but think that this > should be using a string, i.e. declare(function_and_const_lookup='global') > rather than declare(function_and_const_lookup=global). Also, I could make that a voting option, and it could be changed before 8.0 alphas if new

Re: [PHP-DEV] Typed array properties V2

2020-01-24 Thread Mike Schinkel
> On Jan 23, 2020, at 3:04 AM, Rasmus Lerdorf wrote: > You are getting into static analysis territory here with that. There are > already static analysis tools that do exactly this type of array type > checking during development. For example, there are three type mistakes in > this code: >

Re: [PHP-DEV] Typed array properties V2

2020-01-24 Thread Mike Schinkel
Thus far we have discussed that implementation of type checking for arrays would be too costly from a performance perspective and that there is no good solution that is not extremely complicated to implement. Given that, can we consider an alternative? ALLOW the use of a syntax for typed arra

Re: [PHP-DEV] Typed array properties V2

2020-01-24 Thread Rowan Tommins
On 24/01/2020 19:22, Mike Schinkel wrote: Really expensive checks like this belong at the static analysis stage. And yes, it would be amazing to have a static analyzer built into PHP, which is basically what you are asking for here, Expensive checks would not be a problem if they could be run

Re: [PHP-DEV] Typed array properties V2

2020-01-24 Thread Rowan Tommins
On 24/01/2020 19:27, Mike Schinkel wrote: ALLOW the use of a syntax for typed arrays — whether it be type[] or [type] — but only validate that it is an array and that the "type" is in fact a type, but don't actually validate that each element is the correct type. I don't really see much poin

Re: [PHP-DEV] Typed array properties V2

2020-01-24 Thread John Bafford
> On Jan 24, 2020, at 14:27, Mike Schinkel wrote: > > Thus far we have discussed that implementation of type checking for arrays > would be too costly from a performance perspective and that there is no good > solution that is not extremely complicated to implement. > > Given that, can we co

Re: [PHP-DEV] Typed array properties V2

2020-01-24 Thread Mike Schinkel
> On Jan 24, 2020, at 3:47 PM, Rowan Tommins wrote: > > I imagine the reason static analysers are generally run as a separate step > rather than just before execution is because then you _really_ don't care > about performance, and it's more convenient to get the results on demand, > rather th

Re: [PHP-DEV] Initializing constants once, with code?

2020-01-24 Thread tyson andre
I've also put together a *different* proof of concept adding support for named calls of global functions (and only that, no other new allowed types of expressions) from within the expressions of constants. (i.e. global constants, class constants, and parameter defaults). I was considering puttin