Jump to content

Flaw In Php's Namespace, Cannot Import An Entire Namespace,


Hall of Famer

Recommended Posts

Thank for the support then. XD

 

Yeah, lets take a break from the general auto-import feature. Anyone here actually disagree that built-in classes should be auto-imported? I mean, dont you get tired of having to remind yourself of writing a backslash in front of the class names such as ArrayObject and Exception? Even if you dont think its a problem that many programmers end up getting errors for forgetting to put this backslash, its just way too inconvenient and ugly.

Edited by Hall of Famer
Link to comment
Share on other sites

Thank for the support then. XD

 

Yeah, lets take a break from the general auto-import feature. Anyone here actually disagree that built-in classes should be auto-imported? I mean, dont you get tired of having to remind yourself of writing a backslash in front of the class names such as ArrayObject and Exception? Even if you dont think its a problem that many programmers end up getting errors for forgetting to put this backslash, its just way too inconvenient and ugly.

 

It's just a non-issue IMO. Who really cares? It's one character and is part of the language. Learn to use it, and get on with things.

Link to comment
Share on other sites

I think autoloading makes this feature redundant, take kicken's example, is it really that much of a burden to have to type 5 more characters to make your code far more self-explanatory and easier to debug? Not to mention that you're only loading the classes that you actually use...

 

As for Exception and ArrayObject, couldn't you just:

 

use \Exception as Exception;
use \ArrayObject as ArrayObject;

 

I can't test this as I'm on my Dad's laptop which doesn't have PHP installed, but it should work?

No, you only have to write one line like this:

use \Model\User;

 

Then when you use those classes, do:

new User\Member
or 
new User\Admin

Link to comment
Share on other sites

So we should get used to PHP being purely procedural and stop requesting for object oriented features back in the 90s, 'cause its 'part of the language'?

 

It is comments like these that make your opinions less and less respectable.

Link to comment
Share on other sites

I think autoloading makes this feature redundant, take kicken's example, is it really that much of a burden to have to type 5 more characters to make your code far more self-explanatory and easier to debug? Not to mention that you're only loading the classes that you actually use...

 

As for Exception and ArrayObject, couldn't you just:

 

use \Exception as Exception;
use \ArrayObject as ArrayObject;

 

I can't test this as I'm on my Dad's laptop which doesn't have PHP installed, but it should work?

Yes it does work, but PHP has more than just Exception and ArrayObject in their built-in class library. Do you want to import them all manually? If so, write 20-30 lines of code that look completely the same in every script file.

 

 

It is comments like these that make your opinions less and less respectable.

 

How so? I see no difference between your post and mine. 'Its part of the language, PHP isnt Java/C#, you have to get used to it'. Gotta love this kind of quote.

Edited by Hall of Famer
Link to comment
Share on other sites

[/font][/color]

 

It illustrates a general lack of understanding.

 

Nope, not at all. It is the shallowness of your comment that triggered my reply. Yes, lets just stop developing PHP and make PHP 5.5 its final version already. Why keep requesting new features? Whatever we have now is part of the language, lets get used to it and get on with things.

Link to comment
Share on other sites

Yes, lets just stop developing PHP and make PHP 5.5 its final version already. Why keep requesting new features?

 

Have you actually taken part in the development process? Or made RFCs? Because wishcasting here isn't 'developing PHP' nor is it officially requesting new features. We're not tied to Zend. That's why we're generally amused/bemused at your quest to make PHP better. Writing posts here isn't actually accomplishing any of that.

Link to comment
Share on other sites

Of course I am not expecting people from this forum to engage in PHP's development process. Its a board where everyone can freely speak his opinion, and I have a point to discuss about PHP's lacking features that need to be improved. Its a matter of point, not a request to make something happen.

Link to comment
Share on other sites

Which is fine, and believe me, we don't want to stifle discussion. It's just that, after having the same discussion over and over, we tend to get a bit annoyed with how masturbatory it all is. I mean, if you put in the same effort and passion that you put into your posts here in a RFC, you might actually be able to steer PHP in the direction you want. Which is pretty cool.

 

I dunno... it seems like if this is the part that you're most passionate about (and, looking at your post history, it seems like it), then why not harness that passion into something tangible? Why waste time trying to convince us when you can actually convince the powers that be?

 

Again, not saying that you can't, or don't have the right to talk about it here. Just pointing out that you can actually have a hand in the changes you want to see materialize, if you so choose. That's the beauty of open source. You don't need to be on the sidelines.

Link to comment
Share on other sites

Before allowing anything like wildcards or "importing" entire namespaces, I'd like to see namespaces implemented more as black boxes (e.g. namespace-scoped variables and such like).  Currently they are essentially used as class/function/constant name aliases.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.