Stanislav Malyshev wrote: > Hi! > > I answered this exactly question about 100 times already. No, you just > import DB and then do DB::Class1, DB::Class2 etc. up to DB::Class18. > Does nobody ever read anything prior to starting discussing namespaces?
And I'd ask - who wants to do new DB::mysql when they can just do mysql? The common usage of use is going to be to get the name as short as possible, and NOT have to type out db:: everywhere. Do you have code using namespaces? I have some I can point you to of mine. > Well, if it's just a matter of taste - then, well, tastes differ. Saying > "my taste requires every name not to have ::" is not the same as saying > "namespaced functions are useless". Then let me rephrase "Useless to me" - as they are functions in namespaces are useless to me - they do not do what I think they should and do not solve a problem any better than a class with static methods. >> No - imagine your app is all unicode and you want strlen to actually use >> an mbstring or iconv implementation - you could wrap that transparently >> for your template authors. > > Then I'd like hell make sure that unicode strlen and binary strlen have > different names so I could know when I call which - in case I ever get > wrong one called on wrong type of variable, at least until I have PHP 6 > where it is marked with different type and autoconverted. Quickest way > to get into trouble is to have two indistinguishable and incompatible > functions operating on two indistinguishable and incompatible types of > data. Perhaps - but if you want your template users/authors to always have a strlen that works on unicode strlen it makes it much easier for them. You seem to be under the impression that the people writing templates are as skilled in PHP as the people writing the code using the templates (or are the same people) - sadly that's very often not the case. >> Sometimes security is important in templates, depending on who is >> creating them and how you allow users to edit them. Not all >> applications have the same requirements. > > Err? Security? PHP has no intra-language security and never had and > never intended to have. I don't even want to begin to understand how one > could expect to have intra-language security in PHP. Often you want to limit what you're allowing template authors to use - why do you think smarty was written? However that's not really something I want to get into. The bottom line is ... I've given you reasons that I would want to alias functions...and you seem to be doing nothing more than saying "don't design it that way" - which quite frankly seems silly. If there's a good technical reason why you think function_alias wouldn't work other than users doing something stupid (they don't have the same protection with classes). Or if there's a good design reason other than "you should do it the way ZF does" or "I don't do things that way therefore it's wrong" I'd be glad to listen. But so far you haven't convinced me anymore than I've convinced you...and I have talks to finish writing ;) Goodnight, Elizabeth -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php