SitePoint Sponsor

User Tag List

Page 1 of 7 12345 ... LastLast
Results 1 to 25 of 174
  1. #1
    SitePoint Addict pachanga's Avatar
    Join Date
    Mar 2004
    Location
    Russia, Penza
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    YANP (Yet Another Namespace Proposal) for PHP

    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...

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but I am still waiting for their reply on my ideas/comments <g>

  3. #3
    SitePoint Addict
    Join Date
    Apr 2004
    Location
    Melbourne
    Posts
    362
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    SitePoint Guru Galo's Avatar
    Join Date
    May 2005
    Location
    Holland!
    Posts
    852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks exiting..... keep it working...
    Business as usual is off the menu folks, ...

  5. #5
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You won't give up with your quest for namespaces will you....




    .... Ruby has namespace /module support

  6. #6
    SitePoint Addict pachanga's Avatar
    Join Date
    Mar 2004
    Location
    Russia, Penza
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MiiJaySung
    You won't give up with your quest for namespaces will you....
    Heh I already had class names clashes with PHP 5.1 spl and was forced to append useless prefixes...

    .... Ruby has namespace /module support
    Yeah, i know, i spent the last night admiring Ruby specs...

  7. #7
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

    Didn't think so

  8. #8
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, Ruby isn't capable of being a pretty language

  9. #9
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    Really?? Is there anything that Ruby doesn't have, or isn't capable of? Can it make me a cup of coffee huh?

    Didn't think so
    How did I guess you were gonna leave a response to that comment! :P

    Ruby doesn't have a totally stupid company called "Zend" screwing the language up

  10. #10
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wdeboer
    Well, Ruby isn't capable of being a pretty language
    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)

  11. #11
    SitePoint Guru BerislavLopac's Avatar
    Join Date
    Sep 2004
    Location
    Zagreb, Croatia
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  12. #12
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  13. #13
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 )

  14. #14
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BerislavLopac
    What do you mean by @@more_readable!? .
    OK Let's start using C++

    Code:
    Staff* staff = dynamic_cast<Staff*>(person);
    if (staff != NULL) {
        ::std::cout << staff->getName();
    }
    Of course that is more readable than

    Code:
    puts person.name if person.instance_of? Person
    or even (just so we don't leave PHP out )

    Code:
    if ($person instanceOf Staff) echo $person->name;

  15. #15
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well,

    PHP Code:
    if ($person instanceOf Staff) echo $person->name
    I'm sorry, but I find that a lot more expressive than the other examples you've posted.

    But let's not all get silly on this now...

    How did I guess you were gonna leave a response to that comment!
    I'm watching your posts from now on Btw, it is a lowercase 'p' you need to use for the smillie (see what I mean?)

  16. #16
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MiiJaySung
    OK Let's start using C++

    Code:
    Staff* staff = dynamic_cast<Staff*>(person);
    if (staff != NULL) {
        ::std::cout << staff->getName();
    }
    Of course that is more readable than

    Code:
    puts person.name if person.instance_of? Person
    or even (just so we don't leave PHP out )

    Code:
    if ($person instanceOf Staff) echo $person->name;
    Dude, don't forget Java :
    Code:
                
    Method myMethod = person.getClass().getMethod("getName");
    System.out.println(myMethod.invoke(person));

  17. #17
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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));

  18. #18
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bonefry
    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.

  19. #19
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MiiJaySung
    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.
    Hmm... dude, go out, see the world . 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 .

  20. #20
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bonefry
    Hmm... dude, go out, see the world . 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.

    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.

  21. #21
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  22. #22
    SitePoint Enthusiast siteartwork's Avatar
    Join Date
    Jan 2005
    Location
    Germany
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  23. #23
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  24. #24
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Ireland
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  25. #25
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ryan Wray
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •