Re: [PHP-DEV] Callable typehint

2013-05-28 Thread Ferenc Kovacs
On Tue, Jun 7, 2011 at 8:50 PM, Stas Malyshev smalys...@sugarcrm.comwrote: Hi! Am I now supposed to create a new thread with [RFC] in the subject, wait for minimum 2 weeks, and then create a poll somewhere on the wiki and create new thread with [VOTE] in subject, and wait for another

Re: [PHP-DEV] Callable typehint

2013-05-28 Thread Peter Cowburn
On 28 May 2013 07:00, Ferenc Kovacs tyr...@gmail.com wrote: snip sorry for resurrecting the thread, but I think that having a Callable typehint would be nice, and I agree with Etienne that the generic arguments against typehints doesn't really apply here. We've had callable since 5.4.0.

Re: [PHP-DEV] Callable typehint

2013-05-28 Thread Ferenc Kovacs
2013.05.28. 8:48, Peter Cowburn petercowb...@gmail.com ezt írta: On 28 May 2013 07:00, Ferenc Kovacs tyr...@gmail.com wrote: snip sorry for resurrecting the thread, but I think that having a Callable typehint would be nice, and I agree with Etienne that the generic arguments against

Re: [PHP-DEV] Callable typehint

2011-06-07 Thread Jordi Boggiano
On Tue, Jun 7, 2011 at 1:02 AM, Stas Malyshev smalys...@sugarcrm.com wrote: Sure. How about reducing boilterplate code like this: if(is_readable($foo)) {  $var = file_get_contents($foo); } else {  throw  InvalidArgumentException(); } Why won't we make language construct to do that too? I

Re: [PHP-DEV] Callable typehint

2011-06-07 Thread Hannes Magnusson
On Mon, Jun 6, 2011 at 22:49, Christopher Jones christopher.jo...@oracle.com wrote: On 06/06/2011 12:41 PM, Hannes Magnusson wrote: See attached patch+phpt; Any objections to include it in 5.4? Hannes, How about putting up an RFC for it?  Even a brief RFC would be better than none.

Re: [PHP-DEV] Callable typehint

2011-06-07 Thread Richard Quadling
On 7 June 2011 15:00, Hannes Magnusson bj...@php.net wrote: On Mon, Jun 6, 2011 at 22:49, Christopher Jones christopher.jo...@oracle.com wrote: On 06/06/2011 12:41 PM, Hannes Magnusson wrote: See attached patch+phpt; Any objections to include it in 5.4? Hannes, How about putting up an

Re: [PHP-DEV] Callable typehint

2011-06-07 Thread Hannes Magnusson
On Tue, Jun 7, 2011 at 16:04, Richard Quadling rquadl...@gmail.com wrote: On 7 June 2011 15:00, Hannes Magnusson bj...@php.net wrote: On Mon, Jun 6, 2011 at 22:49, Christopher Jones christopher.jo...@oracle.com wrote: On 06/06/2011 12:41 PM, Hannes Magnusson wrote: See attached patch+phpt;

Re: [PHP-DEV] Callable typehint

2011-06-07 Thread Matthew Weier O'Phinney
On 2011-06-07, Hannes Magnusson bj...@php.net wrote: On Mon, Jun 6, 2011 at 22:49, Christopher Jones christopher.jo...@oracle.com wrote: On 06/06/2011 12:41 PM, Hannes Magnusson wrote: See attached patch+phpt; Any objections to include it in 5.4? Hannes, How about putting up an RFC

Re: [PHP-DEV] Callable typehint

2011-06-07 Thread Stas Malyshev
Hi! Am I now supposed to create a new thread with [RFC] in the subject, wait for minimum 2 weeks, and then create a poll somewhere on the wiki and create new thread with [VOTE] in subject, and wait for another 2weeks and then if accepted by 50%+1 php.net developer, and 60% of the community

Re: [PHP-DEV] Callable typehint

2011-06-07 Thread David Zülke
On 07.06.2011, at 12:09, Jordi Boggiano wrote: On Tue, Jun 7, 2011 at 1:02 AM, Stas Malyshev smalys...@sugarcrm.com wrote: Sure. How about reducing boilterplate code like this: if(is_readable($foo)) { $var = file_get_contents($foo); } else { throw InvalidArgumentException(); } Why

[PHP-DEV] Callable typehint

2011-06-06 Thread Hannes Magnusson
Hi As quickly mentioned in the '$arr = array('Hello', 'world'); $arr();' thread[1], we are hitting the need for a callable typehint. See attached patch+phpt; Any objections to include it in 5.4? -Hannes [1] http://php.markmail.org/message/gdas65h3im52sleg Index: Zend/zend.h

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Stas Malyshev
Hi! See attached patch+phpt; Any objections to include it in 5.4? Yes, same objections as for other static typing. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe,

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Hannes Magnusson
On Mon, Jun 6, 2011 at 22:35, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! See attached patch+phpt; Any objections to include it in 5.4? Yes, same objections as for other static typing. That was totally not the purpose of this, and I don't quite understand how you made the connection.

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Christopher Jones
On 06/06/2011 12:41 PM, Hannes Magnusson wrote: See attached patch+phpt; Any objections to include it in 5.4? Hannes, How about putting up an RFC for it? Even a brief RFC would be better than none. Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog:

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Stas Malyshev
Hi! Like I mentioned in the other thread (which I probably should had repeated here), a lot of libs/frameworks are using the 'Closure' typehint for callbacks. Well, they are wrong (unless they mean to use only closures and not callbacks). But that's no reason to do wrong thing in the

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Matthew Weier O'Phinney
On 2011-06-06, Stas Malyshev smalys...@sugarcrm.com wrote: Like I mentioned in the other thread (which I probably should had repeated here), a lot of libs/frameworks are using the 'Closure' typehint for callbacks. Well, they are wrong (unless they mean to use only closures and not

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Pierre Joye
How is this argument different than the one in favor of type hinting (or whatever was what ended in trunk)? On 7 Jun 2011 00:16, Matthew Weier Oapos;Phinney weierophin...@php.net wrote: On 2011-06-06, Stas Malyshev smalys...@sugarcrm.com wrote: Like I mentioned in the other thread (which I

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Matthew Weier O'Phinney
On 2011-06-06, Pierre Joye pierre@gmail.com wrote: --0016e6de0029ddc06f04a5129914 Content-Type: text/plain; charset=ISO-8859-1 How is this argument different than the one in favor of type hinting (or whatever was what ended in trunk)? I was simply voicing my support for Hannes' patch,

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Etienne Kneuss
Hi, On Mon, Jun 6, 2011 at 22:35, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! See attached patch+phpt; Any objections to include it in 5.4? Yes, same objections as for other static typing. Those objections do not apply here IMO. IIRC, the main objections were that if we introduce

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Chris Stockton
Hello, On Mon, Jun 6, 2011 at 12:41 PM, Hannes Magnusson hannes.magnus...@gmail.com wrote: Hi As quickly mentioned in the '$arr = array('Hello', 'world'); $arr();' thread[1], we are hitting the need for a callable typehint. This brings a clear and concise enhancement to PHP which I would

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Chris Stockton
Hello, On Mon, Jun 6, 2011 at 3:51 PM, Chris Stockton chrisstockto...@gmail.com wrote: Hello, On Mon, Jun 6, 2011 at 12:41 PM, Hannes Magnusson hannes.magnus...@gmail.com wrote: Hi As quickly mentioned in the '$arr = array('Hello', 'world'); $arr();' thread[1], we are hitting the need for

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Ferenc Kovacs
On Mon, Jun 6, 2011 at 9:41 PM, Hannes Magnusson hannes.magnus...@gmail.com wrote: Hi As quickly mentioned in the '$arr = array('Hello', 'world'); $arr();' thread[1], we are hitting the need for a callable typehint. See attached patch+phpt; Any objections to include it in 5.4? -Hannes

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Stas Malyshev
Hi! The point, though, is that with such a typehint available, we can reduce boilerplate code like the following: Sure. How about reducing boilterplate code like this: if(is_readable($foo)) { $var = file_get_contents($foo); } else { throw InvalidArgumentException(); } Why won't we make

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Chris Stockton
Hi Stas, On Mon, Jun 6, 2011 at 4:02 PM, Stas Malyshev smalys...@sugarcrm.com wrote: I wouldn't love it a bit, frankly, as rely on PHP's native error handling in this context means bombing out in runtime without any idea what went wrong. When you have exception, you could make it print what

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Derick Rethans
On Mon, 6 Jun 2011, Matthew Weier O'Phinney wrote: The point, though, is that with such a typehint available, we can reduce boilerplate code like the following: public function addCallback($callback) { if (!is_callback($callback)) { throw new

Re: [PHP-DEV] Callable typehint

2011-06-06 Thread Martin Scotta
Martin Scotta On Mon, Jun 6, 2011 at 8:02 PM, Stas Malyshev smalys...@sugarcrm.comwrote: Hi! The point, though, is that with such a typehint available, we can reduce boilerplate code like the following: Sure. How about reducing boilterplate code like this: if(is_readable($foo)) {