[some comments below] Lukas Kahwe Smith wrote: > > On 08.09.2008, at 18:52, Stanislav Malyshev wrote: > >> Hi! >> >>> I think given the feedback from users, we really need to actually >>> benchmark the performance slow down that Greg's proposed changes will >>> bring. I also guess there are two types of users out there: >> >> Could you summarize the feedback? > > I am mainly baseing myself on the feedback I got at: > http://pooteeweet.org/blog/1288 > > However I also got some feedback from others on IRC that all went in the > same direction. > > I think Liz summarized the gripes best (especially the second paragraph > is important to note): > "I've been using namespaces since then went into 5.3. From my experience > functions in namespaces are basically unusable (you can't alias in a > function like you can a class from a namespace - plus there's the > ambiguity issue with static methods).
Constants in namespaces have exactly the same problems, but I do find them useful. In case we remove functions we probably need to remove constants too. Also OO is not the single paradigm and PHP is not a pure OO language, so I don't see a reason to restrict programmers to use only OO libraries. > Writing HUGE blocks of use statements at the top is going to turn people > off and since included files have their own namespace level you can't > even have a file that keeps a block of use statements that are needed on > every page. "Use" statement has effect only on current file and it is done by design. Imagine that you include several files and each of them have several "use" statements. How are you going to identify and resolve possible conflicts? Also the change of "use" statement in one of include file may completely change the behavior in another. It is the thing which we liked to avoid during design. The main PHP namespaces ideas come from Java packages and Java classes have to write these "use" statements in the same way. It's not the end of the world. I believe that well-designed frameworks won't require a lot of use statements in user-space code. > Since I do more than just web applications with PHP, I HAVE run into the > need to get away from the "one namespace per file" rule, and the fact > that you can't have ANYTHING before the opening <?php tag in a file with > a namespace (no whitespace, no html, nothing) without a fatal error > annoys me to no end." It's by design too. Namespace is a declaration statement which says that the complete file belong to this namespace (the mutltiple namespaces per file is just an optimization technique and its introduction made more confusion to the whole implementation then the advantage). I assume namespaces are useful for frameworks and libraries and I hardly imagine that somebody need HTML code before "<?php" tag there. > Chuck adds: > "I think that user-level classes are far more common in PHP than > internal classes, and as such should be given priority." Is is related to __autoload()? Then it's a performance compromise. It's possible to revert the behavior into more logical way, but it may cause huge slowdown. For now I see only one problems with current implementation: Inability of mixing namespaced and non-namespaced code in case of multiple namespaces per file. It makes the file concatenation technique non useful. I don't see a reason in namesapce with brackets for single namespace per file and would like to save current syntax, but for multiple namespaces brackets would help (however, even if brackets might be enabled, I am completely against nested namespaces). Thanks. Dmitry. > regards, > Lukas Kahwe Smith > [EMAIL PROTECTED] > > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php