Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-17 Thread Zeljko Mitic
On Tue, Jul 17, 2018 at 3:39 PM Dan Ackroyd wrote: > On 17 July 2018 at 13:08, Zeljko Mitic wrote: > > > > It won't help, preprocess.io doesn't remove typehints. > > It doesn't _currently_ remove parameter types. > > If you think this is an idea worth doing, you could write the > functionality

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-17 Thread Dan Ackroyd
On 17 July 2018 at 13:08, Zeljko Mitic wrote: > > It won't help, preprocess.io doesn't remove typehints. It doesn't _currently_ remove parameter types. If you think this is an idea worth doing, you could write the functionality to do that. cheers Dan -- PHP Internals - PHP Runtime

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-17 Thread Zeljko Mitic
On Tue, Jul 17, 2018 at 1:18 PM Dan Ackroyd wrote: > On 15 July 2018 at 20:39, Zeljko Mitic wrote: > > PHP is dynamic language and each typed typehinted parameter has to be > > checked every time. > > If you think your code would benefit appreciably from having parameter > types removed, I

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-17 Thread Dan Ackroyd
On 15 July 2018 at 20:39, Zeljko Mitic wrote: > PHP is dynamic language and each typed typehinted parameter has to be > checked every time. If you think your code would benefit appreciably from having parameter types removed, I would strongly recommend looking at https://preprocess.io/ and

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-17 Thread Rowan Collins
On 16 July 2018 at 19:17, Larry Garfield wrote: > It sounds like your main argument for why to even bother with this is > performance. I think you're greatly over-estimating the performance > impact of > type checking. I wager if you just cache a few database lookups and > you'll > get a much

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Larry Garfield
On Monday, July 16, 2018 12:23:42 PM CDT Zeljko Mitic wrote: > On Mon, Jul 16, 2018 at 1:42 PM Rowan Collins > > wrote: > > On 16 July 2018 at 12:06, Arvids Godjuks wrote: > >> Basically, you went wrong when you proposed a switch that controlls > >> language behavior. To add to that - a switch

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Zeljko Mitic
On Mon, Jul 16, 2018 at 1:42 PM Rowan Collins wrote: > On 16 July 2018 at 12:06, Arvids Godjuks wrote: > >> Basically, you went wrong when you proposed a switch that controlls >> language behavior. To add to that - a switch that probably is not >> controllable by code that is running. >> > > >

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Christoph M. Becker
On 16.07.2018 at 13:15, Yasuo Ohgaki wrote: > What you need is DbC. > It's more flexible and complete. It satisfies all of your needs and more. > An issue is that DbC is not static code analysis tool friendly. > > https://wiki.php.net/rfc/introduce_design_by_contract >

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Zeljko Mitic
On Mon, Jul 16, 2018 at 1:44 PM Zeljko Mitic wrote: > > > On Mon, Jul 16, 2018 at 1:14 PM Nikita Popov wrote: > >> On Sun, Jul 15, 2018 at 9:39 PM, Zeljko Mitic wrote: >> >>> PHP is dynamic language and each typed typehinted parameter has to be >>> checked every time. I am suggesting new

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Lester Caine
On 16/07/18 12:14, Zeljko Mitic wrote: But please, do keep in mind that I would like to have this feature as optional. The problem with most of these 'improvements' to PHP is that the case is always made that 'you do not have to use it' and this is yet another load on the code base that 'you

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Zeljko Mitic
On Mon, Jul 16, 2018 at 1:14 PM Nikita Popov wrote: > On Sun, Jul 15, 2018 at 9:39 PM, Zeljko Mitic wrote: > >> PHP is dynamic language and each typed typehinted parameter has to be >> checked every time. I am suggesting new php.ini value "typecheck.enable = >> 1" which can be turned off. >> >>

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Rowan Collins
On 16 July 2018 at 12:06, Arvids Godjuks wrote: > Basically, you went wrong when you proposed a switch that controlls > language behavior. To add to that - a switch that probably is not > controllable by code that is running. > While I agree with your general principle here, I would like to

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Arvids Godjuks
пн, 16 июл. 2018 г. в 14:14, Zeljko Mitic : > > > On Mon, Jul 16, 2018 at 1:06 PM Arvids Godjuks > wrote: > >> пн, 16 июл. 2018 г. в 13:56, Zeljko Mitic : >> >>> I tried to, but I honestly can't see the problem. No decent programmer >>> makes error by sending wrong type of parameter and this

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Yasuo Ohgaki
On Mon, Jul 16, 2018 at 4:46 AM Zeljko Mitic wrote: > PHP is dynamic language and each typed typehinted parameter has to be > checked every time. I am suggesting new php.ini value "typecheck.enable = > 1" which can be turned off. > > Example: > with default php config, a code like this would

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Zeljko Mitic
On Mon, Jul 16, 2018 at 1:06 PM Arvids Godjuks wrote: > пн, 16 июл. 2018 г. в 13:56, Zeljko Mitic : > >> I tried to, but I honestly can't see the problem. No decent programmer >> makes error by sending wrong type of parameter and this feature is 100% >> optional. I know for sure that even in my

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Nikita Popov
On Sun, Jul 15, 2018 at 9:39 PM, Zeljko Mitic wrote: > PHP is dynamic language and each typed typehinted parameter has to be > checked every time. I am suggesting new php.ini value "typecheck.enable = > 1" which can be turned off. > > Example: > with default php config, a code like this would

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Arvids Godjuks
пн, 16 июл. 2018 г. в 13:56, Zeljko Mitic : > I tried to, but I honestly can't see the problem. No decent programmer > makes error by sending wrong type of parameter and this feature is 100% > optional. I know for sure that even in my dev computer, I would use this > feature, and probably most

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Zeljko Mitic
On Mon, Jul 16, 2018 at 12:56 PM Zeljko Mitic wrote: > I tried to, but I honestly can't see the problem. No decent programmer > makes error by sending wrong type of parameter and this feature is 100% > optional. I know for sure that even in my dev computer, I would use this > feature, and

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Zeljko Mitic
I tried to, but I honestly can't see the problem. No decent programmer makes error by sending wrong type of parameter and this feature is 100% optional. I know for sure that even in my dev computer, I would use this feature, and probably most programmers aware of the issue. Maybe simpler example:

Re: [PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-16 Thread Arvids Godjuks
On Sun, Jul 15, 2018, 22:45 Zeljko Mitic wrote: > PHP is dynamic language and each typed typehinted parameter has to be > checked every time. I am suggesting new php.ini value "typecheck.enable = > 1" which can be turned off. > > Example: > with default php config, a code like this would check

[PHP-DEV] [RFC] Optional typehint check for parameters

2018-07-15 Thread Zeljko Mitic
PHP is dynamic language and each typed typehinted parameter has to be checked every time. I am suggesting new php.ini value "typecheck.enable = 1" which can be turned off. Example: with default php config, a code like this would check each member of $users array: function demo(User ...$users) {}