Re: [PHP-DEV] type hinting

2008-01-05 Thread Hannes Magnusson
On Jan 5, 2008 1:52 AM, Jani Taskinen <[EMAIL PROTECTED]> kirjoitti: > Anyway, who dropped the word "OPTIONAL" from the subject? I think that was > quite > essential part of this whole debate? As I'm +1 for OPTIONAL scalar-type > hinting. +1 on scalar-type-hinting (not to be confused with type-c

Re: [PHP-DEV] Re: how to test using run-tests?

2008-01-05 Thread Marcus Boerger
Hello Gregory, Saturday, January 5, 2008, 4:25:00 AM, you wrote: > Index: run-tests.php > === > RCS file: /repository/php-src/run-tests.php,v > retrieving revision 1.226.2.37.2.35.2.10 > diff -u -r1.226.2.37.2.35.2.10 run-tests.php >

Re: [PHP-DEV] type hinting

2008-01-05 Thread Magnus Määttä
On Saturday 05 January 2008, Hannes Magnusson wrote: > On Jan 5, 2008 1:52 AM, Jani Taskinen <[EMAIL PROTECTED]> kirjoitti: > > Anyway, who dropped the word "OPTIONAL" from the subject? I think that was > > quite > > essential part of this whole debate? As I'm +1 for OPTIONAL scalar-type > > hint

Re: [PHP-DEV] type hinting

2008-01-05 Thread Sebastian Bergmann
Magnus Määttä wrote: >> +1 on scalar-type-hinting (not to be confused with type-casting) > I'm also +1 for optional scalar-type hinting FWIW. Same here. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B

[PHP-DEV] Array objects & array functions

2008-01-05 Thread Amir Abiri
Hi, I was wondering if there are any plans to introduce the ability of array functions to work with "array objects". More specifically I was thinking of starting with adding an SPL interface called ArraySearchable, and modifying php_search_array in ext/standard/array.c to accept an object that

Re: [PHP-DEV] type hinting

2008-01-05 Thread Rasmus Lerdorf
PHP is first and foremost a Web scripting language. Everything we do and every decision is based on that. For every feature the first question you need to ask yourselves is: Will this make it easier or harder for the average PHP user to build a web app? And if it makes it harder, is the

Re: [PHP-DEV] type hinting

2008-01-05 Thread Alain Williams
On Sat, Jan 05, 2008 at 09:46:34AM -0800, Rasmus Lerdorf wrote: > PHP is first and foremost a Web scripting language. Everything we do > and every decision is based on that. For every feature the first > question you need to ask yourselves is: > > Will this make it easier or harder for the a

Re: [PHP-DEV] U

2008-01-05 Thread Alain Williams
On Sat, Jan 05, 2008 at 09:48:37PM +0100, Stefan Esser wrote: > Hello, > >> typing into PHP, even if it is optional. Passing $_REQUEST['age'] to a > >> > > that $_REQUEST['age'] has been checked for numeric before the functio > > would you please not use $_REQUEST in any of your examples? $

Re: [PHP-DEV] type hinting

2008-01-05 Thread Stefan Esser
> Be conservative in what you do; be liberal in what you accept from > others. You hopefully realise that this is exactly the opposite of your earlier opinion that ext/filter should be used to block everything and let only harmless data through. And only have raw data on demand... I really do

[PHP-DEV] U

2008-01-05 Thread Stefan Esser
Hello, >> typing into PHP, even if it is optional. Passing $_REQUEST['age'] to a >> > that $_REQUEST['age'] has been checked for numeric before the functio would you please not use $_REQUEST in any of your examples? $_REQUEST is one of the biggest design weaknesses in PHP. Every application

Re: [PHP-DEV] type hinting

2008-01-05 Thread Rasmus Lerdorf
Stefan Esser wrote: Be conservative in what you do; be liberal in what you accept from others. You hopefully realise that this is exactly the opposite of your earlier opinion that ext/filter should be used to block everything and let only harmless data through. And only have raw data on dema

Re: [PHP-DEV] U

2008-01-05 Thread Stefan Esser
>> opinion) reason why type hinting should NOT be introduced. BTW accepting >> the string '1' where an (int) type hint is placed would be the next >> stupid design decision. >> > > Why Because type hinting is supposed to limit what kind of variable type is allowed for a parameter. When you m

Re: [PHP-DEV] U

2008-01-05 Thread Alain Williams
On Sat, Jan 05, 2008 at 10:13:29PM +0100, Stefan Esser wrote: > > >> opinion) reason why type hinting should NOT be introduced. BTW accepting > >> the string '1' where an (int) type hint is placed would be the next > >> stupid design decision. > >> > > > > Why > Because type hinting is suppo

Re: [PHP-DEV] U

2008-01-05 Thread Vlad Bosinceanu
Also, function foo(SomeClass $obj) would error out if passed something other than a SomeClass instance, while function foo(int $number) would just cast $number to int. Not really intuitive and not really consistent. Regards, Vlad Bosinceanu Stefan Esser wrote: Hello, typing into PHP, eve

Re: [PHP-DEV] U

2008-01-05 Thread Daniel Brown
On Jan 5, 2008 3:48 PM, Stefan Esser <[EMAIL PROTECTED]> wrote: > Hello, > >> typing into PHP, even if it is optional. Passing $_REQUEST['age'] to a > >> > > that $_REQUEST['age'] has been checked for numeric before the functio > > would you please not use $_REQUEST in any of your examples? $_REQU

Re: [PHP-DEV] U

2008-01-05 Thread Mike Lively
> Because type hinting is supposed to limit what kind of variable type > is > allowed for a parameter. When you magically convert you kill the whole > idea of type hints and replace it with some magical function parameter > auto type conversion, which would be another hard to understand magic > fea

Re: [PHP-DEV] U

2008-01-05 Thread Markus Fischer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Mike Lively wrote: | in the neck to use effectively. If you start using 'int' type checks for | functions you are going to want to be passing data from _GET, _POST, etc | to, you will have to do is_numeric checks or something similar, so | instea

Re: [PHP-DEV] U

2008-01-05 Thread Sam Barrow
On Sun, 2008-01-06 at 01:11 +0200, Vlad Bosinceanu wrote: > Also, > > function foo(SomeClass $obj) would error out if passed something other > than a SomeClass instance, while > function foo(int $number) would just cast $number to int. > > Not really intuitive and not really consistent. My patc

Re: [PHP-DEV] U

2008-01-05 Thread Sam Barrow
On Sat, 2008-01-05 at 15:59 -0800, Mike Lively wrote: > > Because type hinting is supposed to limit what kind of variable type > > is > > allowed for a parameter. When you magically convert you kill the whole > > idea of type hints and replace it with some magical function parameter > > auto type c

Re: [PHP-DEV] U

2008-01-05 Thread Mike Lively
On Sat, 2008-01-05 at 21:35 -0500, Sam Barrow wrote: > On Sat, 2008-01-05 at 15:59 -0800, Mike Lively wrote: > > > Because type hinting is supposed to limit what kind of variable type > > > is > > > allowed for a parameter. When you magically convert you kill the whole > > > idea of type hints and

Re: [PHP-DEV] U

2008-01-05 Thread Sebastian Bergmann
Mike Lively wrote: > That being said I still do agree with Stefan that changing the type of a > variable would be aweful. I do know that for any purpose I have for > additional type hinting would actually be solved by just introducing > type hints for 'scalar' (read string or int) and 'resource'.