There's a guy Jessie Hernandez who is actively working on namespace implementation for PHP: http://news.php.net/php.internals/17304
It's pretty amazing...
| SitePoint Sponsor |


There's a guy Jessie Hernandez who is actively working on namespace implementation for PHP: http://news.php.net/php.internals/17304
It's pretty amazing...

Yes, but I am still waiting for their reply on my ideas/comments <g>


Don't know if I'd go so far as to call it amazing, but it's definitely promising. We've tried working around it with things like using/import() and __autoload to define where to find classes, but this would be so so so much better.




Looks exiting..... keep it working...
Business as usual is off the menu folks, ...



You won't give up with your quest for namespaces will you....
.... Ruby has namespace /module support![]()


HehOriginally Posted by MiiJaySung
I already had class names clashes with PHP 5.1 spl and was forced to append useless prefixes...
Yeah, i know, i spent the last night admiring Ruby specs....... Ruby has namespace /module support![]()





Really?? Is there anything that Ruby doesn't have, or isn't capable of? Can it make me a cup of coffee huh?Ruby has namespace /module support
Didn't think so![]()
![]()

Well, Ruby isn't capable of being a pretty language![]()



How did I guess you were gonna leave a response to that comment! :POriginally Posted by Dr Livingston
Ruby doesn't have a totally stupid company called "Zend" screwing the language up![]()



That's a bit daft to say. Read a rails app, then read a PHP app. You'll see what's more elegant and more expressive. We are trialing Ruby for new work at work, and as it stands Ruby needs only a small fraction of code, it's more readable and we will be able to work about 2-3 faster (well it's not quite that fast yet as the boss and I are still learning certain things)Originally Posted by wdeboer




What do you mean by @@more_readable!?
P.S. Python also has namespaces, y' know. Lots o' them. And Java too (it calls them packages). And C++. And C#. And probably other languages I know nothing about.




Oh common, not again. People, stop talking about Ruby. It's getting old.
OK, I think we all get it. Ruby is good. So what ? So is Python. So is Perl.
We are talking PHP here.



For those who don't realise the only reason I jokingly brought up the topic of Ruby was because I was discusing Ruby with pachanga a while back before I started learning / using it, and he jokingly asked 'has it got namespace support?' over MSN as I know that pachanga has a lot of woes with PHP5 dropping namespace support.
Had it been anyone else, I wouldn't have mentioned Ruby seeing as it looks like it turned into a swear word here (Maybe the the moderators will replace it with stared '*'s for us)



OK Let's start using C++Originally Posted by BerislavLopac
Of course that is more readable thanCode:Staff* staff = dynamic_cast<Staff*>(person); if (staff != NULL) { ::std::cout << staff->getName(); }
or even (just so we don't leave PHP outCode:puts person.name if person.instance_of? Person)
Code:if ($person instanceOf Staff) echo $person->name;





Well,
I'm sorry, but I find that a lot more expressive than the other examples you've posted.PHP Code:if ($person instanceOf Staff) echo $person->name;
But let's not all get silly on this now...
I'm watching your posts from now onHow did I guess you were gonna leave a response to that comment!Btw, it is a lowercase 'p' you need to use for the smillie
(see what I mean?)




Dude, don't forget JavaOriginally Posted by MiiJaySung
:
Code:Method myMethod = person.getClass().getMethod("getName"); System.out.println(myMethod.invoke(person));




Sorry for this other post but apparently it appears it can be written like this:
Code:System.out.println(person.getClass().getMethod("getName").invoke(person));



Oh it's a good thing I don't use/know Java. What a farce! It's hardly much (if at all) more readable than the C++ version. I can see myself loosing my sainity when I go to uni and get forced into the evil world of Java.Originally Posted by bonefry




Hmm... dude, go out, see the worldOriginally Posted by MiiJaySung
. Are you telling me C++ templates are more readable than the Java reflection api ? Sorry, but you're just religious about it. Oh yeah, you like @@more_readable languages
.



No, I just detest Java with a passion. Java seems so pointless to me. Java has failed to replace C++, after all they seem to have given into using C++ idioms that they once frowned upon, such as Templates / Generics. Java just seems a totally unnatural language. For a start, why does everything need strict static typing in a bytecode / "scripting" (I use the term loosely here language loosely as it's not used as a scripting language, but used in places where scripting is used commonly like web development) language.Originally Posted by bonefry
Java is a bloat. All the tools and downloads you need to get to use it are huge and cumbersome when you compare it to PHP, Python, or Ruby.




Hmm, flame...
Java has failed to replace C++
It wasn't meant to replace C++
...that they once frowned upon, such as Templates / Generics
Generics are not templates. Please note I know what I am talking about.
Java just seems a totally unnatural language
I could say the same thing about Ruby
For a start, why does everything need strict static typing in a bytecode / "scripting" language
For security. Because it is general purpose. And any oppinions you might have here are highly debatable. Also note that unlike C++ Java is semi-dynamic. Also, Groovy kicks as* and there's also Jython and also many other scripting languages build on top of Java.
Java is a bloat.
Can you build Java on top of Python or Ruby or PHP ? No. Also, not very healthy to have such an oppinion towards the world's most used enterprise language.
Sounds good, looks good. I posted a similiar concept some months ago in my blog (http://blog.siteartwork.de/?sectionid=2) - I'd be glad to see that it works![]()




Java style namespaces aren't that good for PHP. A better approach would be Python style modules, where a namespace is associated with a directory:
http://docs.python.org/tut/node8.html
I like them allot. Very clean.


In regards to post #14, by MiiJaySung, I find the PHP the most readable. Fair enough, I am not a Ruby developer, but here are 2 good reasons why I find this:
- You have the condition after the action. In the mindset of a programmer, it is usually the other way round (ie. if condition is true, print person name).
- The question mark after the ?, adds to the confusion.
However, I think anyone (with appropiate OO knowledge) would understand the PHP code.
It could be biased, or simply my opinion though.




Highlly debatable and innacurate your point of view. Don't forget everyone thinks in the language he knows.Originally Posted by Ryan Wray
Bookmarks