atom feed46 messages in net.php.lists.internalsRe: [PHP-DEV] Callable typehint
FromSent OnAttachments
Hannes MagnussonJun 6, 2011 12:41 pm.txt
Hannes MagnussonJun 6, 2011 1:48 pm 
Stas MalyshevJun 6, 2011 2:16 pm 
Matthew Weier O'PhinneyJun 6, 2011 3:15 pm 
Pierre JoyeJun 6, 2011 3:26 pm 
Matthew Weier O'PhinneyJun 6, 2011 3:32 pm 
Etienne KneussJun 6, 2011 3:41 pm 
Chris StocktonJun 6, 2011 3:51 pm 
Chris StocktonJun 6, 2011 3:52 pm 
Ferenc KovacsJun 6, 2011 4:01 pm 
Stas MalyshevJun 6, 2011 4:01 pm 
Chris StocktonJun 6, 2011 4:20 pm 
Derick RethansJun 6, 2011 4:30 pm 
Martin ScottaJun 6, 2011 7:50 pm 
Jordi BoggianoJun 7, 2011 3:08 am 
Hannes MagnussonJun 7, 2011 6:59 am 
Richard QuadlingJun 7, 2011 7:03 am 
Hannes MagnussonJun 7, 2011 7:21 am 
Jaroslav HanslikJun 7, 2011 8:22 am 
Matthew Weier O'PhinneyJun 7, 2011 9:10 am 
Stas MalyshevJun 7, 2011 12:12 pm 
Anthony FerraraJun 7, 2011 12:37 pm 
Mike van RielJun 7, 2011 1:43 pm 
Matthew Weier O'PhinneyJun 7, 2011 1:44 pm 
dukeofgamingJun 7, 2011 2:15 pm 
dukeofgamingJun 7, 2011 3:38 pm 
David ZülkeJun 7, 2011 5:04 pm 
Alexey SheinJun 7, 2011 10:24 pm 
Hannes MagnussonJun 8, 2011 1:38 am 
Alexey SheinJun 8, 2011 1:47 am 
Johannes SchlüterJun 8, 2011 3:04 am 
Richard QuadlingJun 8, 2011 3:27 am 
Johannes SchlüterJun 8, 2011 3:28 am 
Hannes MagnussonJun 8, 2011 3:30 am 
Johannes SchlüterJun 8, 2011 3:31 am 
Anthony FerraraJun 8, 2011 6:31 am 
Martin ScottaJun 8, 2011 7:42 am 
Martin ScottaJun 8, 2011 7:48 am 
Johannes SchlüterJul 10, 2011 12:02 pm 
Hannes MagnussonJul 11, 2011 1:21 am 
Stas MalyshevJul 11, 2011 1:27 am 
Peter CowburnJul 11, 2011 1:37 am 
Hannes MagnussonJul 11, 2011 1:38 am 
Ferenc KovacsMay 27, 2013 10:59 pm 
Peter CowburnMay 27, 2013 11:47 pm 
Ferenc KovacsMay 28, 2013 1:21 am 
Subject:Re: [PHP-DEV] Callable typehint
From:Stas Malyshev (smal@sugarcrm.com)
Date:Jun 6, 2011 2:16:45 pm
List:net.php.lists.internals

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 language too.

The problem with that is a function name as a string and array("classname", "functionname") are considered is_callable(). To get through the intentions of the Closure hint, I would have to wrap the actual callback in a closure - which doesn't make any sense.

"callable" is not actually even a type. If we make it a language construct, then why 'authenticated DB connection', 'name of readable file', 'valid stream URL', 'validated XML', 'string in UTF-8 no longer than 255 characters' or 'balanced binary tree' is not a language construct? I don't think we need to put every data check into the language, especially that it actually makes it worse - you can gracefully handle user-space check, but not a strict typing error.