On Thu, Dec 22, 2011 at 09:09:40AM -0500, Dmitri Snytkine wrote:
> The return type hinting is probably the biggest thing happening in php in a
> long time.
> Is this too good to be true?
> 
> With return type hinting I can see a huge improvenets in php IDEs in
> spotting errors. Also it will be much easier to auto generate wsdl files
> when return types are known to a compiler.
> These are just to name a couple of important benefits that can come out of
> it.
> 
> What I don't see is any discussion of being able to declare the type of
> variable, you now, like in Java.
> ie: 
> private \ArrayObject $customers;

That looks like a namespace - I don't like that syntax.

> Also, is there an implicit "void" return type?
> 
> I hope that declaring types of variables will be added too because without
> it, this feature is not all that useful. 

If - we do allow variable declaration to specify a type, can we also have a
syntax that simply says ''this variable is declared but I am not saying what 
type it is''.
Ie the variable can take any type - just as now.

Why ? One thing that I would really like to see in PHP is the ability to force
variables in a module to be declared -- AKA perl's 'use strict'. Have the 
compiler
complain if it sees a variable that has not been declared.
In a large program the occasional typeo on variable names does happen, catching 
them
with 'use strict' is great!

I have proposed this before and people did not like it. Here is to hopeing for a
different sentiment.

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to