Re: [nyphp-talk] Namespaces

2008-01-22 Thread Rob Marscher
On Jan 20, 2008, at 7:40 AM, leam wrote: How does the require in: require 'MyProject/Db/Connection.php'; from http://www.php.net/manual/en/language.namespaces.using.php know that it's a namespace and not a filepath? Hi Leam, It still is a path. It's including the file MyProject/Db/

Re: [nyphp-talk] Namespaces

2008-01-20 Thread leam
On Wed, 2008-01-16 at 13:12 -0500, Rob Marscher wrote: > Jon Baer posted some good links about namespaces in php... but I'm > surprised no one posted this link: > http://php.net/manual/en/language.namespaces.php How does the require in: require 'MyProject/Db/Connection.php'; from http

Re: [nyphp-talk] Namespaces

2008-01-16 Thread Rob Marscher
On Jan 11, 2008, at 11:23 AM, Jim Hendricks wrote: How crazy would it be if PHP had namespaces and a namespace registration. Jon Baer posted some good links about namespaces in php... but I'm surprised no one posted this link: http://php.net/manual/en/language.namespaces.php

Re: [nyphp-talk] Namespaces

2008-01-12 Thread tedd
At 11:23 AM -0500 1/11/08, Jim Hendricks wrote: When Palm opened up the platform for 3rd party programming, they created a registration page for the database type id's. This allowed for global registration which would eliminate namespace collissions so long as programmers registered the id's t

Re: [nyphp-talk] Namespaces

2008-01-11 Thread John Campbell
Namespaces are supposed to be analogous to folders in the file system. Folders are how we prevent file name collisions, and namespaces are how we prevent function/classname collisions. If you have a bunch of files that might have the same names as an existing file, then you just create a new fold

Re: [nyphp-talk] Namespaces

2008-01-11 Thread Jake McGraw
UDDI is trying to do the same thing (with limited success, I've only looked at their Web Services registration)... check out: http://en.wikipedia.org/wiki/Universal_Description_Discovery_and_Integration Additionally, if you'd like to release software that won't have a namespace conflict, purchase

Re: [nyphp-talk] Namespaces

2008-01-11 Thread Jim Hendricks
When Palm opened up the platform for 3rd party programming, they created a registration page for the database type id's. This allowed for global registration which would eliminate namespace collissions so long as programmers registered the id's they were using prior to distro. Don't know how

Re: [nyphp-talk] Namespaces

2008-01-11 Thread Kenneth Downs
David Krings wrote: Thank you for the great explanation. It triggers yet another question: What to do if two namespaces are identical? Doesn't that end up to be the same problem? And if one changes the namespace for one, doesn't that require to change code referencing functions and classes f

Re: [nyphp-talk] Namespaces

2008-01-11 Thread David Krings
Kenneth Downs wrote: Namespaces are an organizing mechanism, usually associated with classes. Think: Class::functions as Namespaces::classes So let's begin with functions. David Krings writes a nifty function called "ValidateEmail()" and puts in a library. Then Ken Downs writes the sa

Re: [nyphp-talk] Namespaces

2008-01-11 Thread Kenneth Downs
Namespaces are an organizing mechanism, usually associated with classes. Think: Class::functions as Namespaces::classes So let's begin with functions. David Krings writes a nifty function called "ValidateEmail()" and puts in a library. Then Ken Downs writes the same function in a diffe

Re: [nyphp-talk] Namespaces

2008-01-10 Thread Jon Baer
Its also good to scan the last php-internals list and grep for Namespaces discussions as things can automagically change on you :-) http://marc.info/?l=php-internals&m=118355320225178&w=2 http://marc.info/?l=php-internals&m=119308858512331&w=2 - Jon On Jan 10, 2008, at 8:07 PM, David Krings w

Re: [nyphp-talk] Namespaces

2008-01-10 Thread David Krings
Kristina Anderson wrote: I think this has something to do with variable scope? Such as, in ASP (like VB), if you declare a variable i within a function, it loses scope after the function executes and you can have another variable i outside a function which stays in scope (this is NOT necessari

Re: [nyphp-talk] Namespaces

2008-01-10 Thread Kristina Anderson
I think this has something to do with variable scope? Such as, in ASP (like VB), if you declare a variable i within a function, it loses scope after the function executes and you can have another variable i outside a function which stays in scope (this is NOT necessarily a good thing, either).

Re: [nyphp-talk] Namespaces

2008-01-10 Thread Tim Gales
David Krings wrote: Hi! I got sucked into a (probably pointless) discussion about ASP vs. PHP. One of the arguments against using PHP was that there is only a single namespace. Uhm, that took the wind out of my sail as I have no clue what a namespace is and why having only one is really bad.

Re: [nyphp-talk] Namespaces

2008-01-10 Thread Guilherme Blanco
In a few words, one namespace is a way to organize code into scopes. By doing this, you prevent collisions when mixing libraries. One example... Packages Creole, Doctrine and PEAR_DB. All of them has one class named Connection (Ok, I know they already differ in names, but this is just one example

[nyphp-talk] Namespaces

2008-01-10 Thread David Krings
Hi! I got sucked into a (probably pointless) discussion about ASP vs. PHP. One of the arguments against using PHP was that there is only a single namespace. Uhm, that took the wind out of my sail as I have no clue what a namespace is and why having only one is really bad. Anyone can explain