SitePoint Sponsor

User Tag List

Page 1 of 7 12345 ... LastLast
Results 1 to 25 of 174

Hybrid View

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

  9. #9
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    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?
    Well, some people are using Ruby to make a cup of java... does that count as a cup of coffee?

    I don't know how anyone can complain about using an @@ prefix for class variables when PHP needs a $ before every variable, and $this-> before every instance variable.

    Later,
    Douglas
    Hello World

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

  11. #11
    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)

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

  13. #13
    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;

  14. #14
    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));

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

  16. #16
    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 )

  17. #17
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MiiJaySung
    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 )
    Here's an interesting article on that: What You Can't Say
    Hello World

  18. #18
    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 DougBTX
    Here's an interesting article on that: What You Can't Say
    Very nice article Speaking about other languages (especially Ruby) became taboo after a long series of "Ruby has namespaces PHP doesn't" and things like that. It's ok but within limits (i.e. without getting religios about it). And after that limit, there is a place on this forum were you can talk freely about Ruby and it's called "Perl, Python and Other Languages"

  19. #19
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bonefry
    became taboo after a long series of "Ruby has namespaces PHP doesn't"
    I doubt it, mainly because Ruby doesn't have namespaces in the first place

    Douglas
    Hello World

  20. #20
    SitePoint Guru dagfinn's Avatar
    Join Date
    Jan 2004
    Location
    Oslo, Norway
    Posts
    894
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I haven't been able to read this thread until now, but it's interesting. To hopefully make it clearer why it would be useful, a possible minimum set of requirements for a namespace system could be that it should help the following two nightmare scenarios:
    • We want to integrate two large and complex applications. Both of them use a class library containing a Form class, and the Form class is used frequently in both. So any kind of include or require from one to the other invites a name clash which is all over the place. With today's PHP, we need to change all the occurences of the class name in one of the applications, possibly in lots of different files. Even finding all of them could be a problem.
    • We want to introduce a new version of a class library, but the API has been changed. We want make the change by gradual refactoring, but that requires including both versions simultaneously as we're making the change. As it stands now, this is extremely difficult in practice because of a large number of name conflicts between the old and the new version.

    To make both of these scenarios even worse, just add type hinting.
    Dagfinn Reiersøl
    PHP in Action / Blog / Twitter
    "Making the impossible possible, the possible easy,
    and the easy elegant"
    -- Moshe Feldenkrais

  21. #21
    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?)

  22. #22
    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));

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

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

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


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
  •