[PHP-DEV][RFC] Callable Types

2016-04-21 Thread Marcio Almada
Hello everyone, We just completed the draft for the "Callable Types" RFC. This RFC has been recently mentioned during other type related threads on this mailing list, so it feels to be the right time to put the proposal in context: The proposal is at https://wiki.php.net/rfc/callable-types The

AW: [PHP-DEV] [RFC:generics]

2016-04-21 Thread Robert Stoll
Hi Rasmus > Hello internals, > > I'd like to introduce an RFC proposing the addition of generic types and > functions: > > https://wiki.php.net/rfc/generics > > Ben Scholzen started this RFC as a quick draft with a few code samples in > August last year, and I have since then worked > with

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread Thomas Bley
Hello Tom, with default return value I mean to return a certain value if nothing else is returned (similar to method parameters with a default value). example 1: declare(strict_types=0); function my_strpos(string $haystack, string $needle): int = false { return 42; // return 42 return

Re: [PHP-DEV] Quick sanity check ...

2016-04-21 Thread Fleshgrinder
On 4/20/2016 11:03 PM, Stanislav Malyshev wrote: > No of course not. The specific instance of error you had *this time* may > be solved. The problem won't be. You still have to deal with: > - How this object is initialized? How you ensure it *is* initialized and > that initialization is correct (0

Re: [PHP-DEV] Quick sanity check ...

2016-04-21 Thread Fleshgrinder
On 4/21/2016 2:52 AM, Lester Caine wrote: > PHP5.4 http://lsces.org.uk/ 0.41s 3.65Mb > PHP5.6 http://php6.lsces.org.uk/ 0.54s 11.77Mb > PHP7 http://php7.lsces.org.uk/ 0.45s 1.83Mb > > Same set of code ... 3 different fpm instances > PHP5.2 one with eaccelerator will not run :( but I

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread Fleshgrinder
On 4/21/2016 6:33 PM, Thomas Bley wrote: > Hello Tom, > > with default return value I mean to return a certain value if nothing else is > returned (similar to method parameters with a default value). > > example 1: > > declare(strict_types=0); > > function my_strpos(string $haystack, string

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread Fleshgrinder
On 4/21/2016 1:00 PM, Lin Yo-An wrote: > I think this is not to make PHP like Java, and it totally makes sense - > Nullable should be a type of a type instead of a state. In Haskell it's > named Maybe or Option, and It's better than NullPointerException. > > Here is a discussion from Haskell

Re: [PHP-DEV] Re: Improving PHP's type system

2016-04-21 Thread Fleshgrinder
On 4/20/2016 10:18 PM, Dominic Grostate wrote: > Just a thought that crossed my mind which might satisfy both worlds. Has > anyone every considered unions as a type declaration? > > namespace Vector/TypeDefs > > union Stringable > { > as string; > as int; > as float; > >

[PHP-DEV] NEUTRAL Benchmark Results for PHP Master 2016-04-21

2016-04-21 Thread lp_benchmark_robot
Results for project PHP master, build date 2016-04-21 06:28:31+03:00 commit: ecf6392 previous commit:23a4342 revision date: 2016-04-21 02:50:14+02:00 environment:Haswell-EP cpu:Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB

Re: [PHP-DEV] Quick sanity check ...

2016-04-21 Thread Larry Garfield
On 4/21/16 2:11 PM, Fleshgrinder wrote: What I love about PHP is that we have a lot under one hood: multi-paradigm as well as loose and strict types. This allows one to choose the best tool for the current job. ^^ That thing. PHP is a very eclectic language. That's a good thing. Does that

Re: [PHP-DEV] Quick sanity check ...

2016-04-21 Thread Lester Caine
On 21/04/16 20:11, Fleshgrinder wrote: > On 4/20/2016 11:03 PM, Stanislav Malyshev wrote: >> No of course not. The specific instance of error you had *this time* may >> be solved. The problem won't be. You still have to deal with: >> - How this object is initialized? How you ensure it *is*

Re: [PHP-DEV] [RFC:generics]

2016-04-21 Thread Dennis Birkholz
Hi all, Am 20.04.2016 um 16:44 schrieb guilhermebla...@gmail.com: > If I want to hire/move a person to a department that is registered in the > system, but is not a 3rd party company person, how would you achieve that > considering the following class structure? > > class Person {} > class

[PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Dmitry Stogov
Hi, I would like to present an RFC proposing support for native annotation. The naming, syntax and behavior are mostly influenced by HHVM Hack, but not exactly the same. The most interesting difference is an ability to use arbitrary PHP expressions as attribute values. These expressions are

Re: [PHP-DEV] [RFC:generics]

2016-04-21 Thread Larry Garfield
On 4/21/16 10:43 AM, Rowan Collins wrote: guilhermebla...@gmail.com wrote on 21/04/2016 16:25: I understand others mentioned we could create a new interface that wraps the other two interfaces, but that still doesn't solve the problem where I want to extend a class AND also implement a

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Dmitry Stogov
On 04/22/2016 12:52 AM, Larry Garfield wrote: On 4/21/16 4:13 PM, Dmitry Stogov wrote: Hi, I would like to present an RFC proposing support for native annotation. The naming, syntax and behavior are mostly influenced by HHVM Hack, but not exactly the same. The most interesting

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Ryan Pallas
On Thu, Apr 21, 2016 at 4:51 PM, Dmitry Stogov wrote: > > >> About expressions, isn't there an ambigoutiy? <> is a "plain" >> name, value based attribute. But it could also be an ast\node of a function >> call to "test(1)" >> > even in AST scalars are scalars. > so

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Dominic Grostate
This is amazing. It would actually allow us to implement our automated assertions ourselves, as opposed to requiring it within the language. Could it also support references? <> function foo($a) { } On 21 Apr 2016 10:13 p.m., "Dmitry Stogov" wrote: > Hi, > > >

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Dmitry Stogov
On 04/22/2016 02:02 AM, Ryan Pallas wrote: On Thu, Apr 21, 2016 at 4:51 PM, Dmitry Stogov > wrote: About expressions, isn't there an ambigoutiy? <> is a "plain" name, value based attribute. But it could also be an

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Dmitry Stogov
On 04/22/2016 02:09 AM, Colin O'Dell wrote: > A more robust alternative would be something along the same lines that > Doctrine uses: Make annotations actual classes. Just spitballing here - what if both approaches were supported, but class-based annotations were prefixed with a special

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Colin O'Dell
> > $r = new ReflectionClass('ORM\Entity'); > var_dump($r->getAttributes()); > Oops, that should've been: $r = new ReflectionClass('Foo'); var_dump($r->getAttributes()); Colin

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread Thomas Bley
> Note that the same /would/ be possible with union types if given precedence: > > function fn(): int|false {} false is currently not supported in the union_types rfc. Regards Thomas Fleshgrinder wrote on 21.04.2016 21:33: > On 4/21/2016 6:33 PM, Thomas Bley wrote: >> Hello Tom, >> >> with

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Larry Garfield
On 4/21/16 4:13 PM, Dmitry Stogov wrote: Hi, I would like to present an RFC proposing support for native annotation. The naming, syntax and behavior are mostly influenced by HHVM Hack, but not exactly the same. The most interesting difference is an ability to use arbitrary PHP expressions

Re: [PHP-DEV] [VOTE] Catching Multiple Exception Types

2016-04-21 Thread Dan Ackroyd
On 20 April 2016 at 23:16, Patrick ALLAERT wrote: > It's also perfectly possible to make all those Exceptions implement a > "MatchingFailedException" interface (even empty). Apologies for continuing the conversation, even after the RFC is incredibly likely to pass, but;

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Dmitry Stogov
On 04/22/2016 01:03 AM, Benjamin Eberlei wrote: On Thu, Apr 21, 2016 at 11:13 PM, Dmitry Stogov > wrote: Hi, I would like to present an RFC proposing support for native annotation. The naming, syntax and behavior are mostly

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Benjamin Eberlei
On Thu, Apr 21, 2016 at 11:52 PM, Larry Garfield wrote: > On 4/21/16 4:13 PM, Dmitry Stogov wrote: > >> Hi, >> >> >> I would like to present an RFC proposing support for native annotation. >> >> The naming, syntax and behavior are mostly influenced by HHVM Hack, but >>

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Colin O'Dell
> A more robust alternative would be something along the same lines that > Doctrine uses: Make annotations actual classes. Just spitballing here - what if both approaches were supported, but class-based annotations were prefixed with a special character (perhaps "@") to differentiate them? For

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Sara Golemon
On Thu, Apr 21, 2016 at 2:13 PM, Dmitry Stogov wrote: > I would like to present an RFC proposing support for native annotation. > I'm trying to imagine where the benefit of non-constant expressions comes in. <> Assuming we roll in php-ast at the same time (which is

Re: [PHP-DEV] PHP 7.1 roadmap

2016-04-21 Thread Davey Shafik
I'd interested in co-RMing 7.1 if someone else wants to step up also? - Davey On Thu, Apr 21, 2016 at 2:47 AM, Julien Pauli wrote: > On Tue, Apr 12, 2016 at 10:20 PM, Scott Arciszewski > wrote: > > On Tue, Apr 12, 2016 at 2:29 PM, Anatol Belski

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread guilhermebla...@gmail.com
Hi Dmitry, As a previous suggester of metadata information built-in into PHP, and also one of developers of the most used metadata library written in PHP, I understand this feature implementation requires several design decisions and also a good understanding of specific situations users may

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Dmitry Stogov
On 04/22/2016 02:16 AM, Dominic Grostate wrote: This is amazing. It would actually allow us to implement our automated assertions ourselves, as opposed to requiring it within the language. this was the idea - to give a good tool instead of implementing every possible use-case in the

Re: [PHP-DEV] [RFC:generics]

2016-04-21 Thread Rowan Collins
Jesse Schalken wrote on 21/04/2016 04:18: Sticking with your example for a moment, if the type parameter is an "int", then the only type that can /currently/ be expressed in the type language that is a subtype of "int" is "int", so it's not very useful /right now/. However, a possible

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread fsb
+1 to what Dmity wrote. I prefer not to have ?Something argument hints but I acknowledge that others want it. Tom From: Dmitry Stogov Sent: ‎Wednesday‎, ‎April‎ ‎20‎, ‎2016 ‎12‎:‎13‎ ‎PM To: guilhermebla...@gmail.com, Lin Yo-An Cc: Tom Worster, internals What we really miss

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread fsb
Hi Thomas, What is a default return declaration? Is this for branches within the function that do not lead to a return statement? Tom From: Thomas Bley Sent: ‎Wednesday‎, ‎April‎ ‎20‎, ‎2016 ‎12‎:‎53‎ ‎PM To: guilhermebla...@gmail.com, cornelius.h...@gmail.com, dmi...@zend.com Cc:

Re: [PHP-DEV] [RFC:generics]

2016-04-21 Thread guilhermebla...@gmail.com
I see that some of you are confusing union types with intersecting types here. The idea is not an OR, but an AND. I'll repeat the same example again to try to exemplify what I mentioned: class AA {} interface B {} interface C {} class BB extends AA implements B {} class CC extends AA implements

Re: [PHP-DEV] [RFC:generics]

2016-04-21 Thread Dominic Grostate
Nope, it pretty much made perfect sense to me the first time. But you may get your wish in it going in with the proposal anyway as I don't think this RFC is going to make it in time for the 7.1 window. My crack at implementing it went bust when I realised I was adding too many execute globals.

Re: [PHP-DEV] [RFC:generics]

2016-04-21 Thread Rowan Collins
guilhermebla...@gmail.com wrote on 21/04/2016 16:25: I understand others mentioned we could create a new interface that wraps the other two interfaces, but that still doesn't solve the problem where I want to extend a class AND also implement a specific interface. I covered this case in my

Re: [PHP-DEV] Safe timeout handling

2016-04-21 Thread Julien Pauli
On Wed, Apr 20, 2016 at 12:58 PM, Dmitry Stogov wrote: > Hi, > > > It's a well known PHP problem, that exceeding of execution time-out > (max_execution_time) may lead to unexpected crashes. > > They occur because PHP may be interrupted in inconsistent state, and attempt > to

Re: [PHP-DEV] PHP 7.1 roadmap

2016-04-21 Thread Julien Pauli
On Tue, Apr 12, 2016 at 10:20 PM, Scott Arciszewski wrote: > On Tue, Apr 12, 2016 at 2:29 PM, Anatol Belski wrote: >> >> Hi, >> >> Time goes by fast - no sooner 7.0 was unleashed on the world than 7.1 >> bangs >> at the door. I would like to bring a couple of

Re: [PHP-DEV] [RFC:generics]

2016-04-21 Thread Josh Di Fabio
On Wed, Apr 20, 2016 at 8:17 PM, Dominic Grostate wrote: > Thanks for you're input everyone. > > So far, we have read some ideas for handling upper bounds, or multiple there > of. > The preferred keywords appear to be either "as" or "instanceof". > > class Foo {} >

Re: [PHP-DEV] [RFC] Nullable Types

2016-04-21 Thread Lin Yo-An
On Wed, Apr 20, 2016 at 11:05 PM, guilhermebla...@gmail.com < guilhermebla...@gmail.com> wrote: > > Dmitry is even involved in the discussion of having IS_UNDEF until > constructor ends, then enforcing type hinting at the end of constructor to > trigger potential invalid instance state. It created

RE: [PHP-DEV] Safe timeout handling

2016-04-21 Thread Anatol Belski
Hi Dmitry, > -Original Message- > From: Dmitry Stogov [mailto:dmi...@zend.com] > Sent: Wednesday, April 20, 2016 12:58 PM > To: Nikita Popov ; Rasmus Lerdorf > ; Anatol Belski ; Antony Dovgal > ; Zeev Suraski