Re: PHP 6.0 Wishlist
| From: | sebastian | Date: | Mon, 15 Aug 2005 18:52:28 +0000 |
| Subject: | Re: PHP 6.0 Wishlist | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-18142@lists.php.net to get a copy of this message | ||
Howdy all,
I work at a company with about 8 programmers, and after some discussion we decided the following would be nice to add to the language:
W1: Type hints. It'd be nice if you could mark a variable as string or int, so that if we set an int to "foozle" a warning will be raised. Of course type hints shouldn't be required, but it'd be nice if we could use them where we want. Before any one tries to suggest it: No, we will not create an object for integers and one for strings.
W2: Lexical scoping. It'd be nice if we didn't have to worry about variables within a function conflicting. Any sort of code block-level scoping would be nice. Consider something like Perl's my() operator. At the very least, it'd be nice to be able to lexically close iteration variables used in loops.
W3: Arrays and associative arrays - not some screwed up, problematic hybrid. We consider this to be a major flaw. Arrays should be arrays, associative arrays should be associative. This is especially problematic in reporting applications we develop.
W4: Better lambda/anonymous functions and debugging for them. Consider Perl's anonymous functions which disappear as the references to them disappear. See the create_function() docs for notes about "memory leaks." Although they aren't really memory leaks, and there are simple work arounds, this behavior is rather sucky. Also, if I have something like:
15: array_map(create_function('$a','
echo $a;
echo "\n";
ad934k33;;;asd!
'
), $list)
I'll get an error about a lambda function line 3 at line 15 of script.php. It'd be nice if it told me it was on line 18 of script.php. Of course, this is wishful thinking. Perl has two forms of eval: string and block. For string evaluations with errors it tells me that the error occurred at line 3 of eval'ed code, but for block evals, it would tell me line 18... just something to think about.
Regarding Rasmus' first post, I am:
+1 removal of register globals
+1 removal of magic_quotes
+1 removal of really old deprecated functions
and have nutral feelings about the rest. I'm happy with whichever provides the most simplicity and best performance.
- sebastian