Nathan Rixham wrote:
> [...]
>
> while I'm here I may as well also ask about further adding type
> hinting for the existing scalars and array.
+1, but I don't know what might have stopped it being implemented before
(time, parsing API changes, etc), so it would be interesting to look
into the history.

> and finally different method signatures such as:
>
> class Whatever {
>   public function __construct(Bar b);
>   public function __construct(Foo f);
>   public function doSomething(Bar b);
>   public function doSomething(Foo f);
> }
+1. Having overloaded function definitions like this would be very
useful, but I don't know how awkward it would be to implement - I don't
know how the function pointers are currently stored. I could imagine
adding information about the type signature to the internal method name,
and looking up based on that... but then I don't know how it's stored so
I might be talking rubbish!

Also, what about this case:

class MyTestClass {
  public function blah(Foo $f);
  public function blah(Bar $b);
  public function blah($v);
}

I would argue that the most specific function should be called, but how
costly would that be to determine? What if you have a "Baz" subclass of
Bar, but no corresponding method? What if Bar itself is a subclass of Foo?


Dave

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to