On Fri, 22 Apr 2016 07:12:13 +0300, Marcio Almada <marcio.w...@gmail.com>
wrote:
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 W.I.P patch is available for testing through http://3v4l.org under
the
RFC tab.
We count with your detailed feedback and insights. Let's have a nice,
respectful and
constructive conversation about the RFC and work on possible
improvements!
Thanks
Nikita Nefedov
Márcio Almada
Hello internals,
We're still having a hard time finding a proper format for error message
about incompatible callable being passed.
Right now it looks like this:
Uncaught TypeError: Argument 3 passed to reduce() must be callable of
compliant signature: callable(integer, integer): integer, callable($a, $b,
$c) given, called in ...
Although it goes in the fashion with all other TypeErrors but it's
obviously very cryptic and it will be hard to read for human.
One of the alternatives Marcio proposed was:
Uncaught TypeError: Argument 3 passed to reduce() must be compliant
with callable(integer, integer): integer, incompatible callable($a, $b,
$c) received, called in ...
This is remarkably more readable but if you have any suggestions you're
welcome.
Actually I think other type errors are not very readable as well, take
f.e.:
Argument 1 passed to foo() must be an instance of string, boolean given
The fact that `string` and `boolean` are separated by only one comma,
and the way `boolean given` is worded (verb after noun) makes it harder
to read. So maybe we could reconsider type error messages and change them
to something more user-friendly, if there's support for this idea...
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php