Robin Burchell wrote:
On Sun, Jan 18, 2009 at 9:39 PM, Nathan Rixham <nrix...@gmail.com> wrote:
I've reworded my original mail completely maybe this one will have more
feedback (or not)
question: Would anybody else like to see, or feel the need for, *optional*
type hinting of variables and class properties in PHP?
I was involved on a thread on exactly this some weeks earlier. I (and
a few others, though I don't really remember specifics) would very
much appreciate the possibilities of proper code structure when
working with large teams that this could help provide :)
it was a thread "q on primatives" i think.. guess who started it *ducks*
(As to your original proposal, multiple method signatures is something
I've come across a need for *occasionally*, though personally, I'm not
a big fan of the feature -- the one place I would like having it is
__construct().
noted; found the same thing, another specific being that all classes
have a default no arg constructor so it can be instantiated prior to
calling the setters even if there's a constructor which demands params.
Say, you've got an ORM class which is derived for usage:
[snip]
very interesting that you give an ORM example; this is exactly the area
where I've found the need for this class property type hinting (and on
web services tbh) - but still, mapping a "private bool $flag" to a
tinyint(1) is so much easier than mapping a "private $flag" to it
(complications multiplied somewhat with other data types)
Yes, I realise that this can be done with retrieving arguments and the
like, but for such purposes it's not the neatest solution
syntactically.)
agreed any possible implementation in php feels like more of an
inefficiant hack tbh (perhaps a bit strong..)?
cheers!
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php