Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-05-25 Thread Marcus Boerger
Hello Felipe, please do not allow non optional parameters after optional parameters. Also default value NULL seems pretty odd for a numeric type and it might be an idea to only allow types matching the type hint. But I guess it is in line the current type hints and a good solution to mark those

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-18 Thread Arvids Godjuks
+1 for strict types. That way it will be simple: * Don't need - then don't use at all * You need it - you use it fully. One thing than left to clearfy - do we allow to hint only part of args or do we go the road if hint args, then hint them all! (I'm personaly for second one - be strict)

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-18 Thread Richard Quadling
On 18/04/2008, Arvids Godjuks [EMAIL PROTECTED] wrote: +1 for strict types. That way it will be simple: * Don't need - then don't use at all * You need it - you use it fully. One thing than left to clearfy - do we allow to hint only part of args or do we go the road if hint args, then

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-18 Thread Sam Barrow
On Fri, 2008-04-18 at 12:33 +0100, Richard Quadling wrote: On 18/04/2008, Arvids Godjuks [EMAIL PROTECTED] wrote: +1 for strict types. That way it will be simple: * Don't need - then don't use at all * You need it - you use it fully. One thing than left to clearfy - do we allow

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-18 Thread Felipe Pena
Em Sex, 2008-04-18 às 10:22 +0300, Arvids Godjuks escreveu: +1 for strict types. That way it will be simple: * Don't need - then don't use at all * You need it - you use it fully. One thing than left to clearfy - do we allow to hint only part of args or do we go the road if hint args,

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Arvids Godjuks
What about types like array mixed Ok, for mixed we may not use type hinting at all - does patch allow to hint only part of function args? If we have a function, witch takes as 1st argument array or string and other args should have strict types or just use call like myFunc(Array($string), .)

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Paul Biggar
Hi, Your current implementation seems to be inconsistent with both itself and the rest of PHP. I hope this can be rectified before it is included. PHP is inconsisent enough without adding more. 1.) There are a number of is_* functions. It seems obvious that they should be consistent with this.

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Sam Barrow
On Thu, 2008-04-17 at 14:52 +0200, Paul Biggar wrote: Hi, Your current implementation seems to be inconsistent with both itself and the rest of PHP. I hope this can be rectified before it is included. PHP is inconsisent enough without adding more. 1.) There are a number of is_*

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Alain Williams
On Thu, Apr 17, 2008 at 10:01:13AM -0400, Sam Barrow wrote: On Thu, 2008-04-17 at 14:52 +0200, Paul Biggar wrote: just the copy in the callee - I think this is a good idea). As an example, this will fail, which it shouldnt: function y (int $x) { assert (is_int($x); } y (24); The problem

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Paul Biggar
Hi Sam, On Thu, Apr 17, 2008 at 4:01 PM, Sam Barrow [EMAIL PROTECTED] wrote: \ 2.) is_int has different semantics to the int type hint. Numeric strings qualify as the latter, but not the former. In general this is a problem. It seems type hints can only be made consistent if they

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Stanislav Malyshev
Hi! Your current implementation seems to be inconsistent with both itself and the rest of PHP. I hope this can be rectified before it is included. PHP is inconsisent enough without adding more. If you talk about consistency, you should remember that right now no function and no feature in

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Stanislav Malyshev
Hi! The problem with this is that there's not much point in converting the value. PHP will do that anyway, making this kind of pointless. There would be a point since PHP might convert to different type that you intended. Think of $foo = My age is $age. If $age is supposed to be int, then

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Pierre Joye
Hi Stanislav, On Thu, Apr 17, 2008 at 7:02 PM, Stanislav Malyshev [EMAIL PROTECTED] wrote: Hi! Your current implementation seems to be inconsistent with both itself and the rest of PHP. I hope this can be rectified before it is included. PHP is inconsisent enough without adding more.

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Stanislav Malyshev
Hi! Please try to minimize redundant response (at least within 15 mins). I think we all got that you are against type hints in PHP, that's plain Against strict type hints, yes. -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 MSN: [EMAIL

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Sam Barrow
On Thu, 2008-04-17 at 10:06 -0700, Stanislav Malyshev wrote: Hi! The problem with this is that there's not much point in converting the value. PHP will do that anyway, making this kind of pointless. There would be a point since PHP might convert to different type that you intended.

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Derick Rethans
On Thu, 17 Apr 2008, Felipe Pena wrote: Now with both parameter and return value type hints. For parameter type hints, i have completed the actual implementation with the leftover php types: - string (binary string and unicode) - integer (accepting numeric string too) - double (accepting

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Stanislav Malyshev
I understand it very well, but why have a whole other system of type It's the same system. The same system that makes internal functions work. -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 MSN: [EMAIL PROTECTED] -- PHP Internals - PHP

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Paul Biggar
On Thu, Apr 17, 2008 at 7:02 PM, Stanislav Malyshev [EMAIL PROTECTED] wrote: Your current implementation seems to be inconsistent with both itself and the rest of PHP. I hope this can be rectified before it is included. PHP is inconsisent enough without adding more. If you talk about

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Stanislav Malyshev
Hi! If you talk about consistency, you should remember that right now no function and no feature in PHP relies on strict checking of primitive types. That is not the case (or I am very much mistaken). In particular, is_int, which I mentioned in my email, is predicated on the IS_LONG type

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Paul Biggar
Hi, On Thu, Apr 17, 2008 at 8:22 PM, Stanislav Malyshev [EMAIL PROTECTED] wrote: If you talk about consistency, you should remember that right now no function and no feature in PHP relies on strict checking of primitive types. That is not the case (or I am very much mistaken). In

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Stanislav Malyshev
Hi! is_* are the important functions, since they are the ones which most resemble the type hints under discussion. Up until now, anyone Circular argument here. implementing this in user-land would use is_int(). It makes perfect No, you shouldn't do that - there's absolutely no reason to

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Mark van der Velden
Derick Rethans wrote: On Thu, 17 Apr 2008, Felipe Pena wrote: Now with both parameter and return value type hints. For parameter type hints, i have completed the actual implementation with the leftover php types: - string (binary string and unicode) - integer (accepting numeric string too) -

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Stanislav Malyshev
I think that the typehints should be strict, if you don't want strictness, don't use type hints. Note that right now we already have non-strict typehints in most of the internal functions, so you *are* using them if you use PHP. -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED]

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Pierre Joye
On Thu, Apr 17, 2008 at 8:41 PM, Stanislav Malyshev [EMAIL PROTECTED] wrote: Circular argument here. No comment. Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Paul Biggar
On Thu, Apr 17, 2008 at 8:41 PM, Stanislav Malyshev [EMAIL PROTECTED] wrote: is_* are the important functions, since they are the ones which most resemble the type hints under discussion. Up until now, anyone Circular argument here. Yes, I phrased that badly. I believe it is fair to say

Re: [PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-17 Thread Jarismar Chaves da Silva
+1 Derick Rethans wrote: On Thu, 17 Apr 2008, Felipe Pena wrote: Now with both parameter and return value type hints. For parameter type hints, i have completed the actual implementation with the leftover php types: - string (binary string and unicode) - integer (accepting numeric string

[PHP-DEV] [RFC] Type hints (parameter and return value)

2008-04-16 Thread Felipe Pena
Hello again! Now with both parameter and return value type hints. For parameter type hints, i have completed the actual implementation with the leftover php types: - string (binary string and unicode) - integer (accepting numeric string too) - double (accepting numeric string too) - boolean