Re: RE: </endnamespacediscussion>
| From: | Lester Caine | Date: | Mon, 27 Oct 2008 19:29:16 +0000 |
| Subject: | Re: RE: </endnamespacediscussion> | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41481@lists.php.net to get a copy of this message | ||
Vesselin Kenashkov wrote:
1. One user of namespaced constants & functions here... I dont like to use objects for everything. I have very few constants & functions but I would like them to remain constants & functions instead of converting them to static classes or object methods. 2. One reason against dropping ns for functions & constants is that if you drop them how you can namespace legacy (or to avoid that word, not OOP) code? This way many libraries can not be namespaced and if you have a name collision you will not be able to solve it using namespaces. 3. I prefer using\name\spaces instead of prefixing_my_classes. Here is why - I want to organize my files in a hierarchical way in the file structure. A possible solution withtout namespace using prefixes couldbe level1_level2_classname (spliting the name by _). But if I want it to be class_name? Then I have an confusion. And I personaly dislike camelCase and level1_level2_className does not works for me. Because of this I prefer to have namespaces instead of class prefixes. Then I can do name\space\class_name. 4. When you have namespace you can short_the_long_class_name used multiple times in your code importing the namespace and then using the 'shortcut'. I put the last two just to explain why I prefer to have namespace with whatever by separator instead of dropping them.I'm with you on that Vesselin. Will I use namespace - probably not, but I can see straight away blocks of code in projects I'm involved with that require functions at least in the namespace. SO they should be re-written? Probably, but one of the tidiest ways of handling even that is to wrap the legacy code in it's own namespace. If functions and constants were dropped simply to push an incomplete solution through, then it would cause a lot more trouble than the current flack. The result is not 'ideal' but it is perfectly functional and from what I've seen so far WILL work with legacy code. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php