Re: [PHP-DEV] RE: Optional scalar type hinting

2008-01-04 Thread Tomi Kaistila
It really doesn't fit in very well with PHP's loosely typed nature which is one of the main reasons it has been so easy to use. I think this is one of the cornerstones that two sides disagree the most on. People are afraid that PHP would turn into a strong-typed language by allowing type

Re: [PHP-DEV] RE: Optional scalar type hinting

2008-01-04 Thread Derick Rethans
On Thu, 3 Jan 2008, Stanislav Malyshev wrote: I don't get it. We already have type hinting, just not for scalars. The Type hinting for scalars is different because it disables one of the features of PHP language - conversion of scalar types into each other. It doesn't disable this. It's

Re: [PHP-DEV] RE: Optional scalar type hinting

2008-01-04 Thread Derick Rethans
On Thu, 3 Jan 2008, Sam Barrow wrote: It doesn't disable type conversion unless you specifically tell it to. Plus the fact that if it issues an E_WARNING, your application will not necessarily stop execution. Stop right here for a moment. Type hints currently throw an E_RECOVERABLE_ERROR,

Re: [PHP-DEV] RE: Optional scalar type hinting

2008-01-04 Thread Derick Rethans
On Thu, 3 Jan 2008, Sam Barrow wrote: On Thu, 2008-01-03 at 22:37 +0100, Markus Fischer wrote: Of course, Jochem, you're right. Exceptions would be nice. WrongArgumentException, InvalidWhateverException, ... That would be very nice. The full blown suite of exception error handlers

[PHP-DEV] Loose lips sink ships or who REALLY uses loosely typed code?

2008-01-04 Thread Richard Quadling
Hi. I've been trying to get a sensible understanding of the for's and against's of the optional scalar type hinting question. With that I have a few points and a question. 1 - In the main, PHP is used to create web pages and to deal with data coming from the user. 2 - In the main, the data

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 10:55 +, Alain Williams wrote: On Thu, Jan 03, 2008 at 10:36:15PM -0600, Gregory Beaver wrote: Hi all, As someone who has dealt with many scripts written by others as well as many of my own in a large-scale project (PEAR). I can say with absolute certainty

[PHP-DEV] Re: Interfaces name Interface, was: [PHP-DEV] Re: Idea for namespacelookup resolution

2008-01-04 Thread Jessie Hernandez
Hi Markus, Thanks for testing out the patch! Has anyone else had a chance to test it out? I think this is a good solution to the naming conflict issue that is currently present with namespaces, but I'd love to hear other's opinions/experiences on this. -- Jessie Hernandez Zend Certified

Re: [PHP-DEV] RE: Optional scalar type hinting

2008-01-04 Thread Sam Barrow
On Thu, 2008-01-03 at 15:58 -0600, Brian Moon wrote: I don't get it. We already have type hinting, just not for scalars. The discussion seems to be about whether or not we should have it all. But, the truth is, we have it. We half way have it. I fought for it to be all or nothing back

Re: [PHP-DEV] type hinting

2008-01-04 Thread Alain Williams
On Thu, Jan 03, 2008 at 10:36:15PM -0600, Gregory Beaver wrote: Hi all, As someone who has dealt with many scripts written by others as well as many of my own in a large-scale project (PEAR). I can say with absolute certainty that scalar type hints would not make my job easier. In fact,

Re: [PHP-DEV] RE: Optional scalar type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 10:06 +0200, Tomi Kaistila wrote: It really doesn't fit in very well with PHP's loosely typed nature which is one of the main reasons it has been so easy to use. I think this is one of the cornerstones that two sides disagree the most on. People are afraid that PHP

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 09:52 -0600, Gregory Beaver wrote: Alain Williams wrote: On Thu, Jan 03, 2008 at 10:36:15PM -0600, Gregory Beaver wrote: Hi all, As someone who has dealt with many scripts written by others as well as many of my own in a large-scale project (PEAR). I can say

Re: [PHP-DEV] type hinting

2008-01-04 Thread Ilia Alshanetsky
To add another two points to Stefan's argument. Type hinting does not remove the need to filter user input, but it does allow you to safe- guard internal functions (library code etc...) against accidental or internal misuse or improper handling of the data in the front-end layer. It also

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 17:53 +0100, Pierre wrote: On Jan 4, 2008 5:53 PM, Pierre [EMAIL PROTECTED] wrote: On Jan 4, 2008 4:52 PM, Gregory Beaver [EMAIL PROTECTED] wrote: But I *don't* want my functions to take an argument of arbitrary type - it is in fact you who are missing the point.

Re: [PHP-DEV] type hinting

2008-01-04 Thread Gregory Beaver
Alain Williams wrote: On Thu, Jan 03, 2008 at 10:36:15PM -0600, Gregory Beaver wrote: Hi all, As someone who has dealt with many scripts written by others as well as many of my own in a large-scale project (PEAR). I can say with absolute certainty that scalar type hints would not make

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stefan Esser
Good Morning everyone, one should not forget that type hinting has some clear advantages the anti type hinting advocates always try to forget... * the code gets smaller because not so many typechecks in every function * because the code gets smaller it is faster executed (userspace typecheck is

Re: [PHP-DEV] type hinting

2008-01-04 Thread Pierre
On Jan 4, 2008 5:53 PM, Pierre [EMAIL PROTECTED] wrote: On Jan 4, 2008 4:52 PM, Gregory Beaver [EMAIL PROTECTED] wrote: But I *don't* want my functions to take an argument of arbitrary type - it is in fact you who are missing the point. A type hint is a poor solution to a real problem

Re: [PHP-DEV] type hinting

2008-01-04 Thread Pierre
On Jan 4, 2008 4:52 PM, Gregory Beaver [EMAIL PROTECTED] wrote: But I *don't* want my functions to take an argument of arbitrary type - it is in fact you who are missing the point. A type hint is a poor solution to a real problem that is much more easily solved via simple input validation

Re: [PHP-DEV] type hinting

2008-01-04 Thread Pierre
On Jan 4, 2008 6:20 PM, Marcus Boerger [EMAIL PROTECTED] wrote: Hello Pierre, we never accepted this as a pro argument. Infact we often saw the necessaity to highlight something is optional to vote against it. We do this for a reason. That is we only want to support mainstream features. My

Re: [PHP-DEV] type hinting

2008-01-04 Thread Marcus Boerger
Hello Pierre, we never accepted this as a pro argument. Infact we often saw the necessaity to highlight something is optional to vote against it. We do this for a reason. That is we only want to support mainstream features. marcus Friday, January 4, 2008, 5:53:56 PM, you wrote: On Jan 4,

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 11:51 -0500, Ilia Alshanetsky wrote: To add another two points to Stefan's argument. Type hinting does not remove the need to filter user input, but it does allow you to safe- guard internal functions (library code etc...) against accidental or internal misuse or

Re: [PHP-DEV] type hinting

2008-01-04 Thread Pierre
On Jan 4, 2008 6:01 PM, Sam Barrow [EMAIL PROTECTED] wrote: On Fri, 2008-01-04 at 17:53 +0100, Pierre wrote: On Jan 4, 2008 5:53 PM, Pierre [EMAIL PROTECTED] wrote: On Jan 4, 2008 4:52 PM, Gregory Beaver [EMAIL PROTECTED] wrote: But I *don't* want my functions to take an argument of

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 18:09 +0100, Pierre wrote: On Jan 4, 2008 6:01 PM, Sam Barrow [EMAIL PROTECTED] wrote: On Fri, 2008-01-04 at 17:53 +0100, Pierre wrote: On Jan 4, 2008 5:53 PM, Pierre [EMAIL PROTECTED] wrote: On Jan 4, 2008 4:52 PM, Gregory Beaver [EMAIL PROTECTED] wrote:

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 09:52 -0600, Gregory Beaver wrote: Alain Williams wrote: On Thu, Jan 03, 2008 at 10:36:15PM -0600, Gregory Beaver wrote: Hi all, As someone who has dealt with many scripts written by others as well as many of my own in a large-scale project (PEAR). I can say

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 17:41 +0100, Stefan Esser wrote: Good Morning everyone, one should not forget that type hinting has some clear advantages the anti type hinting advocates always try to forget... * the code gets smaller because not so many typechecks in every function True. *

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 12:48 -0500, Robert Cummings wrote: On Fri, 2008-01-04 at 12:41 -0500, Sam Barrow wrote: On Fri, 2008-01-04 at 12:37 -0500, Robert Cummings wrote: On Fri, 2008-01-04 at 18:23 +0100, Pierre wrote: On Jan 4, 2008 6:20 PM, Marcus Boerger [EMAIL PROTECTED] wrote:

Re: [PHP-DEV] type hinting

2008-01-04 Thread Alain Williams
On Fri, Jan 04, 2008 at 12:11:41PM -0500, Sam Barrow wrote: Exactly. I just added the mixed type hint which is the same as using no type hint. The new patch is attached. Extra keywords (real, long, double, etc.) have been taken out. The available type hints are now mixed, int, float, bool,

Re: [PHP-DEV] type hinting

2008-01-04 Thread Lukas Kahwe Smith
On Jan 4, 2008, at 6:37 PM, Robert Cummings wrote: On Fri, 2008-01-04 at 18:23 +0100, Pierre wrote: On Jan 4, 2008 6:20 PM, Marcus Boerger [EMAIL PROTECTED] wrote: Hello Pierre, we never accepted this as a pro argument. Infact we often saw the necessaity to highlight something is optional

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 12:37 -0500, Robert Cummings wrote: On Fri, 2008-01-04 at 18:23 +0100, Pierre wrote: On Jan 4, 2008 6:20 PM, Marcus Boerger [EMAIL PROTECTED] wrote: Hello Pierre, we never accepted this as a pro argument. Infact we often saw the necessaity to highlight

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
* the code gets smaller because not so many typechecks in every function What do you mean not so many? You need one per checked parameter. * because the code gets smaller it is faster executed (userspace typecheck is slower than engine-space) If you need single-opcode-level speedups, you

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 18:44 +0100, Lukas Kahwe Smith wrote: On Jan 4, 2008, at 6:37 PM, Robert Cummings wrote: On Fri, 2008-01-04 at 18:23 +0100, Pierre wrote: On Jan 4, 2008 6:20 PM, Marcus Boerger [EMAIL PROTECTED] wrote: Hello Pierre, we never accepted this as a pro argument.

Re: [PHP-DEV] type hinting

2008-01-04 Thread Lars Strojny
Hi Sam, Am Freitag, den 04.01.2008, 12:11 -0500 schrieb Sam Barrow: [...] Exactly. I just added the mixed type hint which is the same as using no type hint. The new patch is attached. [...] To make your patch better you should add a bunch of test cases. Just a test brainstorming: *

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 18:23 +0100, Pierre wrote: On Jan 4, 2008 6:20 PM, Marcus Boerger [EMAIL PROTECTED] wrote: Hello Pierre, we never accepted this as a pro argument. Infact we often saw the necessaity to highlight something is optional to vote against it. We do this for a reason.

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 17:51 +, Alain Williams wrote: On Fri, Jan 04, 2008 at 12:37:19PM -0500, Robert Cummings wrote: IMHO, optionally inclusion of type hinting for functions/methods can only be a boon to code quality and readability. IMHO when a type hint is provided and a parameter

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 12:41 -0500, Sam Barrow wrote: On Fri, 2008-01-04 at 12:37 -0500, Robert Cummings wrote: On Fri, 2008-01-04 at 18:23 +0100, Pierre wrote: On Jan 4, 2008 6:20 PM, Marcus Boerger [EMAIL PROTECTED] wrote: Hello Pierre, we never accepted this as a pro

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 17:46 +, Alain Williams wrote: On Fri, Jan 04, 2008 at 12:11:41PM -0500, Sam Barrow wrote: Exactly. I just added the mixed type hint which is the same as using no type hint. The new patch is attached. Extra keywords (real, long, double, etc.) have been taken

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 12:51 -0500, Sam Barrow wrote: On Fri, 2008-01-04 at 12:48 -0500, Robert Cummings wrote: On Fri, 2008-01-04 at 12:41 -0500, Sam Barrow wrote: On Fri, 2008-01-04 at 12:37 -0500, Robert Cummings wrote: On Fri, 2008-01-04 at 18:23 +0100, Pierre wrote: On Jan 4,

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 12:53 -0500, Sam Barrow wrote: On Fri, 2008-01-04 at 17:51 +, Alain Williams wrote: On Fri, Jan 04, 2008 at 12:37:19PM -0500, Robert Cummings wrote: IMHO, optionally inclusion of type hinting for functions/methods can only be a boon to code quality and

RE: [PHP-DEV] RE: Optional scalar type hinting

2008-01-04 Thread Andi Gutmans
See below: -Original Message- From: Sam Barrow [mailto:[EMAIL PROTECTED] Sent: Friday, January 04, 2008 5:47 AM To: Andi Gutmans Cc: internals@lists.php.net Subject: RE: [PHP-DEV] RE: Optional scalar type hinting On Thu, 2008-01-03 at 21:34 -0800, Andi Gutmans wrote: We've

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
[**] I suppose that we might implement the type hint 'mixed' which would have the same effect as no type hint. Some people might like this from the 'internal documentation' point of view. And the purpose of that exercise would be? -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED]

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
layer. It also makes the code far more readable and understandable not the mention help doc generation tools that interrogate the code. I was under impression that it is good manners to actually document your code and not rely on the tools to interrogate your code. Of course, not everybody

Re: [PHP-DEV] type hinting

2008-01-04 Thread Ilia Alshanetsky
On 4-Jan-08, at 1:20 PM, Stanislav Malyshev wrote: layer. It also makes the code far more readable and understandable not the mention help doc generation tools that interrogate the code. I was under impression that it is good manners to actually document your code and not rely on the

Re: [PHP-DEV] type hinting

2008-01-04 Thread Alain Williams
On Fri, Jan 04, 2008 at 12:37:19PM -0500, Robert Cummings wrote: IMHO, optionally inclusion of type hinting for functions/methods can only be a boon to code quality and readability. IMHO when a type hint is provided and a parameter doesn't match the type hint then I think a fatal error should

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 13:22 -0500, Ilia Alshanetsky wrote: On 4-Jan-08, at 1:20 PM, Stanislav Malyshev wrote: layer. It also makes the code far more readable and understandable not the mention help doc generation tools that interrogate the code. I was under impression that it is good

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 18:46 +, Alain Williams wrote: On Fri, Jan 04, 2008 at 01:06:26PM -0500, Robert Cummings wrote: ?php echo 'Foo: '.(0 + '5five').\n; echo 'Foo: '.((int)'5five').\n; echo 'Foo: '.(intval( ' 5five' )).\n; echo 'Foo: '.(sprintf( '%d', '5five'

RE: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 10:37 -0800, Andi Gutmans wrote: I think the mixed identifier is a minor issue but I also don't see it's purpose. If you don't want type hinting then don't write a type hint. It's also tool friendly... Andi It is kind of pointless, just syntactic sugar to be honest. Not

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 10:35 -0800, Stanislav Malyshev wrote: It's funny sometimes the complaints about too complicated. I mean, if people don't want to use a complicated feature then they shouldn't. I Not an argument. don't think cutting the legs out from developers who want to use said

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 10:28 -0800, Stanislav Malyshev wrote: Exactly. I just added the mixed type hint which is the same as using no type hint. The new patch is attached. IMO adding new type hint for the sole purpose of having some string next to the variable is just silly. If you need

Re: [PHP-DEV] RE: Optional scalar type hinting

2008-01-04 Thread Stanislav Malyshev
I've stated my opinion on this, I'm going for standard hinting. Int means int, not 1 or one or 1one. Bool means boolean true or false, I don't see any difference in substance between 1 and 1. not true, 1, 0, 0, etc. Same for boolean - I don't see any substantial difference between (int)0,

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 10:59 -0800, Stanislav Malyshev wrote: Not necessarily, if you have a function that performs a generic operation on any object. As for resources you are right, it might be Like what? I don't know many operations that are good for any object and only object and need

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 11:26 -0800, Stanislav Malyshev wrote: A language that can be used for large scale applications, with tons of extensions for integration with many third party applications and protocols. PHP is no longer a form submitter/emailer. Hey, you are right, it isn't! It is

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
This is not what we are doing. We are not changing PHP into a type-strict language. This is type hinting. This is completely different. For type hinting that you propose to work, you need to change PHP into type-strict language. -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED]

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 11:20 -0800, Stanislav Malyshev wrote: Ok but if someone inputs an array in the query string i have a problem Which problem? OK, you'd have string Array instead once you handle it. If it's a problem, then having Array from the start is a problem too. Yes, and the type

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
Ok but if someone inputs an array in the query string i have a problem Which problem? OK, you'd have string Array instead once you handle it. If it's a problem, then having Array from the start is a problem too. with that. And I said standardized way, ie bool true outputs as 1, float 5.20

Re: [PHP-DEV] type hinting

2008-01-04 Thread Alain Williams
On Fri, Jan 04, 2008 at 02:06:09PM -0500, Sam Barrow wrote: No, it's not better. Having GD image instead of mysql connection is not better than having integer in any way. It would just produce different error message, so what? That's actually very true. But the liklyhood is that the

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
What's smaller, type checking with parameter type hinting, or manually using is_int, is_string, etc? Smaller from what POV? Developer-side, it's the same - one check there, one check here. Execution-side, since is_integer is a function and not operation, it's a tiny bit slower, but as I said,

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
Exactly. I just added the mixed type hint which is the same as using no type hint. The new patch is attached. IMO adding new type hint for the sole purpose of having some string next to the variable is just silly. If you need documentation, use documentation. Extra keywords (real, long,

RE: [PHP-DEV] RE: Optional scalar type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 10:08 -0800, Andi Gutmans wrote: See below: -Original Message- From: Sam Barrow [mailto:[EMAIL PROTECTED] Sent: Friday, January 04, 2008 5:47 AM To: Andi Gutmans Cc: internals@lists.php.net Subject: RE: [PHP-DEV] RE: Optional scalar type hinting On

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
It's funny sometimes the complaints about too complicated. I mean, if people don't want to use a complicated feature then they shouldn't. I Not an argument. don't think cutting the legs out from developers who want to use said features is the solution. I mean we're all programmers around

RE: [PHP-DEV] type hinting

2008-01-04 Thread Andi Gutmans
I think the mixed identifier is a minor issue but I also don't see it's purpose. If you don't want type hinting then don't write a type hint. It's also tool friendly... Andi -Original Message- From: Ilia Alshanetsky [mailto:[EMAIL PROTECTED] Sent: Friday, January 04, 2008 10:23 AM To:

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 13:02 -0500, Robert Cummings wrote: On Fri, 2008-01-04 at 12:51 -0500, Sam Barrow wrote: On Fri, 2008-01-04 at 12:48 -0500, Robert Cummings wrote: On Fri, 2008-01-04 at 12:41 -0500, Sam Barrow wrote: On Fri, 2008-01-04 at 12:37 -0500, Robert Cummings wrote: On

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
IMHO, optionally inclusion of type hinting for functions/methods can only be a boon to code quality and readability. IMHO when a type hint is provided and a parameter doesn't match the type hint then I think a fatal error should occur. This forces the user of the function that has So you code

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
To make it optional was to lower the issues for those who don't care about argument strictness. We did not give them this choice for the OO strictness. OO mandates you to work in certain way. However, the way PHP works with values was never type-strict and there's no reason to suddenly change

RE: [PHP-DEV] type hinting

2008-01-04 Thread Andi Gutmans
Look it boils down to the following: True type enforcement ala === (i.e. you pass 1 to an int and it errors out) does not make sense for PHP (and yes, philosophy and design goals of the language are important). Forget even the argument that this is not how PHP works all around and is inconsistent

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
Not necessarily, if you have a function that performs a generic operation on any object. As for resources you are right, it might be Like what? I don't know many operations that are good for any object and only object and need special function to perform them. Actually, excluding scenarios

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
Well PHP is changing into an enterprise-level language now. Out with the What is enterprise-level language? old, in with the new. And I'm sure there were some developers who did want this feature but didn't necessarily say anything. So what? There are developers that don't want this feature

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
You are right. I should have written... I don't think preventing developers from building a stronger foundation upon which they can stand is the solution. Nobody prevents you from building any foundation. I am convinced that in fact using of typehints as proposed now would lead to worse, not

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 11:01 -0800, Stanislav Malyshev wrote: Well PHP is changing into an enterprise-level language now. Out with the What is enterprise-level language? A language that can be used for large scale applications, with tons of extensions for integration with many third party

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 11:04 -0800, Stanislav Malyshev wrote: Well it would be much easier to type hint than to manually document every one of your function parameters. How is this: /* @param $client string Contains the name of the client for the account is worse or less clear or

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 10:30 -0800, Stanislav Malyshev wrote: To make it optional was to lower the issues for those who don't care about argument strictness. We did not give them this choice for the OO strictness. OO mandates you to work in certain way. However, the way PHP works with

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stefan Esser
Stanislav Malyshev schrieb: * the code gets smaller because not so many typechecks in every function What do you mean not so many? You need one per checked parameter. There is a difference in complexity between a userlevel type check and a low level type check. * with type hints byte code

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 10:23 -0800, Stanislav Malyshev wrote: * the code gets smaller because not so many typechecks in every function What do you mean not so many? You need one per checked parameter. What's smaller, type checking with parameter type hinting, or manually using is_int,

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 10:35 -0800, Stanislav Malyshev wrote: It's funny sometimes the complaints about too complicated. I mean, if people don't want to use a complicated feature then they shouldn't. I Not an argument. don't think cutting the legs out from developers who want to use said

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
It is kind of pointless, just syntactic sugar to be honest. Not a big More like syntactic used motor oil IMHO ;) -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 MSN: [EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing

Re: [PHP-DEV] RE: Optional scalar type hinting

2008-01-04 Thread Stanislav Malyshev
Definitely not. Type hints now throw E_RECOVERABLE_ERROR, and that should be the same for any other typehinting system that we add. Then we don't add any, because without static type control it's just a ticking timebomb waiting to blow up your production code (and having application display

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 19:19 +, Alain Williams wrote: On Fri, Jan 04, 2008 at 02:06:09PM -0500, Sam Barrow wrote: No, it's not better. Having GD image instead of mysql connection is not better than having integer in any way. It would just produce different error message, so what?

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 20:13 +0100, Stefan Esser wrote: Stanislav Malyshev schrieb: * the code gets smaller because not so many typechecks in every function What do you mean not so many? You need one per checked parameter. There is a difference in complexity between a userlevel type check and

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
A language that can be used for large scale applications, with tons of extensions for integration with many third party applications and protocols. PHP is no longer a form submitter/emailer. Hey, you are right, it isn't! It is actually used right now for large scale applications, with tons of

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
About the same, but the @param comment doesn't stop someone from putting an array into $client. No, it doesn't. The function should handle that. -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 MSN: [EMAIL PROTECTED] -- PHP Internals - PHP

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 11:27 -0800, Stanislav Malyshev wrote: About the same, but the @param comment doesn't stop someone from putting an array into $client. No, it doesn't. The function should handle that. Ok, in a bunch of extra unwanted code and a call to trigger_error(). Or we could

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 17:46 +, Alain Williams wrote: On Fri, Jan 04, 2008 at 12:11:41PM -0500, Sam Barrow wrote: Exactly. I just added the mixed type hint which is the same as using no type hint. The new patch is attached. Extra keywords (real, long, double, etc.) have been taken

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 11:20 -0800, Stanislav Malyshev wrote: Ok but if someone inputs an array in the query string i have a problem Which problem? OK, you'd have string Array instead once you handle it. If it's a problem, then having Array from the start is a problem too. with that.

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
Good point. We were fine before OO and exceptions too weren't we. No, actually we weren't as fine. OO allowed for application frameworks and libraries to flourish. -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 MSN: [EMAIL PROTECTED]

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
I'd prefer that than have garbage in the database. If your application drops dead in the middle of work because some handle can't process the data your database probably won't be in the best shape anyway. -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/

Re: [PHP-DEV] type hinting

2008-01-04 Thread Lukas Kahwe Smith
Hi, Ok here is a genious idea. We call for a 24 hour period of silence on this topic. All people eager to post just re-read all previous emails and once the 24 hours are over you know what has been said already so that you can actually make sure to say something novel. What would be even

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 11:52 -0800, Stanislav Malyshev wrote: Good point. We were fine before OO and exceptions too weren't we. No, actually we weren't as fine. OO allowed for application frameworks and libraries to flourish. Now that we have them, we can help them become more robust by

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 18:20 +0100, Marcus Boerger wrote: Hello Pierre, we never accepted this as a pro argument. Infact we often saw the necessaity to highlight something is optional to vote against it. We do this for a reason. That is we only want to support mainstream features. What

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 11:54 -0800, Stanislav Malyshev wrote: I'd prefer that than have garbage in the database. If your application drops dead in the middle of work because some handle can't process the data your database probably won't be in the best shape anyway. Yes, it drops dead, I

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
There is a difference in complexity between a userlevel type check and a low level type check. Rather minimal. How should one have an optimizer for that as long PHP does not have this feature? Noone would implement one that is capable of doing this not knowing if the feature ever makes it

Re: [PHP-DEV] type hinting

2008-01-04 Thread Robert Cummings
On Fri, 2008-01-04 at 11:27 -0800, Stanislav Malyshev wrote: This is not what we are doing. We are not changing PHP into a type-strict language. This is type hinting. This is completely different. For type hinting that you propose to work, you need to change PHP into type-strict

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
Ok deal. On Fri, 2008-01-04 at 21:19 +0100, Lukas Kahwe Smith wrote: Hi, Ok here is a genious idea. We call for a 24 hour period of silence on this topic. All people eager to post just re-read all previous emails and once the 24 hours are over you know what has been said already so

Re: [PHP-DEV] type hinting

2008-01-04 Thread Stanislav Malyshev
Also true, and the resource hint is still useful for documentation and clarity of code. Better than no type hint I'd say. Documentation belongs to documentation. We already have perfectly good phpdoc. -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 11:27 -0800, Stanislav Malyshev wrote: This is not what we are doing. We are not changing PHP into a type-strict language. This is type hinting. This is completely different. For type hinting that you propose to work, you need to change PHP into type-strict

Re: [PHP-DEV] type hinting

2008-01-04 Thread Pierre
On Jan 4, 2008 8:20 PM, Stanislav Malyshev [EMAIL PROTECTED] wrote: Ok but if someone inputs an array in the query string i have a problem Which problem? OK, you'd have string Array instead once you handle it. If it's a problem, then having Array from the start is a problem too. with

Re: [PHP-DEV] type hinting

2008-01-04 Thread Sam Barrow
On Fri, 2008-01-04 at 20:51 +0100, Pierre wrote: On Jan 4, 2008 8:20 PM, Stanislav Malyshev [EMAIL PROTECTED] wrote: Ok but if someone inputs an array in the query string i have a problem Which problem? OK, you'd have string Array instead once you handle it. If it's a problem, then

Re: [PHP-DEV] type hinting

2008-01-04 Thread Markus Fischer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Robert Cummings wrote: | On Fri, 2008-01-04 at 11:52 -0800, Stanislav Malyshev wrote: | Good point. We were fine before OO and exceptions too weren't we. | No, actually we weren't as fine. OO allowed for application frameworks | and libraries to

RE: [PHP-DEV] type hinting

2008-01-04 Thread Andi Gutmans
At least I suggest that people limit themselves to max 1 email per hour (incl. Stas Sam) - preferably 2-3 per day. Just take a 1-2 hour breather after you've sent an email and then read the whole thread that comes back and answer multiple arguments in one email. Seriously, the person answering

Re: [PHP-DEV] type hinting

2008-01-04 Thread Brian Moon
Andi Gutmans wrote: Look it boils down to the following: True type enforcement ala === (i.e. you pass 1 to an int and it errors out) does not make sense for PHP (and yes, philosophy and design goals of the language are important). What I suggested in my previous email is type hinting which

Re: [PHP-DEV] type hinting

2008-01-04 Thread Jani Taskinen
I'm not gonna start the discussion about making this list read-only again, maybe it's just enough that Stas is not allowed to post? :D 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

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

2008-01-04 Thread Gregory Beaver
Hi, I'm trying to figure out how to test a feature in the phar extension that requires the executable test file to be an actual phar archive. This would be possible if there was some way to load the --FILE-- section from an external file. Would anyone object to adding a new section to the .phpt

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

2008-01-04 Thread Gregory Beaver
Gregory Beaver wrote: Hi, I'm trying to figure out how to test a feature in the phar extension that requires the executable test file to be an actual phar archive. This would be possible if there was some way to load the --FILE-- section from an external file. Would anyone object to

  1   2   >