On Wed, 2008-02-06 at 06:30 -0700, Chris Stockton wrote: > To me it does not make sense to have a scalar type hint. For the > simple reason it's inconsistent with PHP, and it adds no value other > then the fact you then know the value is not on array (or maybe not a
Ok. Well the array type hint ensures that it is an array. This just does the opposite then, I don't see a problem with that. I like to be able to protected my code from having arrays/objects accidentally inserted into databases or outputted. > resource?). It's also inconsistent with PHP, array type hinting, is > complemented by array type-casting like print_r((array) "foobar"), you Who wants to do print_r((array) "foobar")? I've never seen array type casting, it's pointless. You're proving my point here. > can not echo (scalar) Array('FooBar'); for obvious reasons. I > understand type hinting is not type casting (duh) but I think they > should correlate more then they do, it just makes sense. This is not casting at all, it's a completely different concept with a completely different purpose. A scalar type cast is useless you're right, but a scalar type hint is completely different. > I have no idea the technicals behind not being able to add stricter > type hints, like; float int string, etc. But that would make a lot > more sense then the proposed scalar type hint. Do it right, or don't > add a hack is my opinion. Why is a scalar type hint not acceptable if an array type hint is? That's what I really want to know. > -Chris > > On Feb 6, 2008 6:20 AM, Derick Rethans <[EMAIL PROTECTED]> wrote: > > On Wed, 6 Feb 2008, Sam Barrow wrote: > > > > > On Wed, 2008-02-06 at 09:31 +0100, Derick Rethans wrote: > > > > > > > > I still we should add simple static typehints (ie. just the types that > > > > we use in the manual) - and they should behave in the same way as the > > > > other type hints that we laready have. > > > > > > True, but we have to consider the fact that we don't have enough support > > > on that side. > > > > This is not some election campaign were you change what you believe in > > just to go get followers. So no, I will not take that into > > consideration. > > > > Derick > > > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php