Matthias Nothhaft wrote:
declare_superglobal($_MYVAR);

Has one single superglobal $_APP (or $_USER or the like) already been discussed? (Sorry Andi, couldn't find it in this list and didn't find the 'engine2' list you were referencing at all).


I second Matthias that some sort of user-controlled superglobal would be useful in frameworks, even if it was only one.

Stefan Walk wrote:
> global $_MYFW;

I consider global the worst option ever as is has to be repeated inside every function. Redundant and bug prone.

$GLOBALS['_MYFW'] is a bit better but very ugly and a pain to use.

Timm Friebe wrote:
> MYFW::getInstance()->method_a();

Very clumsy. There's a reason why I'm not using Java! (-:C
And no, it does _not_ work with PHP4 and excuse me, but PHP5 is far from being deployed at your friendly ISP. Don't fool yourselves, PHP4 will be around (and has to be supported by people writing PHP frameworks) for quite a while.


An $_APP superglobal wouldn't allow multiple frameworks to coexist but I think there'd be enough uses to justify it.

It'd for example allow me to turn $_REQUEST into an object, i.e. I could use $_APP->id instead of $_REQUEST['id'] which is so much nicer to use. And no, I don't use form variables with names that aren't valid PHP identifiers ;-). The abuse of $_SESSION for this was already condemned and I'd be uncomfortable to use $_REQUEST (or one of it's siblings) itself.

Ok, ready to take the beating,
- Chris

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



Reply via email to