Re: [PHP-DEV] Reserved namespaces
On 31.03.2009, at 08:51, Hannes Magnusson wrote: On Tue, Mar 31, 2009 at 04:47, Greg Beaver wrote: Lukas Kahwe Smith wrote: So where are we at here? If nobody proposes something, this will just slide by .. I propose reserving PHP. extensions can be PHP\extname (i.e. class PHP\Phar, or for extensions with multiple levels of hierarchy PHP\PDO\mysql etc.) +1 I don't think we should magically raise errors if someone tries to declare such namespace, but updating the userland naming guide would be good. That being said; Would it be possible to enforce the PHP\ internally? Otherwise extension authors will simply ignore the rule and come up with their own conventions... Ok, is this settled now? Anyone working a patch? regards, Lukas Kahwe Smith m...@pooteeweet.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
On Tue, Mar 31, 2009 at 04:47, Greg Beaver wrote: > Lukas Kahwe Smith wrote: >> >> So where are we at here? >> If nobody proposes something, this will just slide by .. > > I propose reserving PHP. extensions can be PHP\extname (i.e. class > PHP\Phar, or for extensions with multiple levels of hierarchy > PHP\PDO\mysql etc.) +1 I don't think we should magically raise errors if someone tries to declare such namespace, but updating the userland naming guide would be good. That being said; Would it be possible to enforce the PHP\ internally? Otherwise extension authors will simply ignore the rule and come up with their own conventions... -Hannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
Lukas Kahwe Smith wrote: > > On 13.03.2009, at 00:39, Andrei Zmievski wrote: > >> Christian Schneider wrote: >>> Things gettings reserved at a later stage (like originally keywords, now >>> namespaces) can lead to a big deal of frustration. Therefore I think it >>> is crucial to have a clear naming guide now. >>> And these guidelines have to be noticed by everybody who starts to use >>> namespaces so they have to be placed prominently. >>> Personally I'd even prefer them to be enforced in code so they can't be >>> missed. >>> Removing restrictions later on causes less trouble so I wouldn't mind >>> too much if a couple of namespaces (or namespace prefixes) are reserved >>> but never used. >> >> Just a gentle reminder to make sure we don't miss this.. > > > So where are we at here? > If nobody proposes something, this will just slide by .. I propose reserving PHP. extensions can be PHP\extname (i.e. class PHP\Phar, or for extensions with multiple levels of hierarchy PHP\PDO\mysql etc.) Alternately, we forbid namespaces in extensions, and thus users can guarantee no conflict with PHP internals simply by using them. Anything else will lead to insanity very quickly. Either we'll get wonderful conflicts or no way to figure out in advance what namespaces are OK. Ilia's suggestion of reserving any extension, current or future, as a namespace makes it impossible to predict what namespaces should not be used in userspace, and as we know, extensions can have literally any name. This, in my opinion, is no option at all, as we need to be able to know whether names we choose can be safely used with future versions of PHP. Greg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
IMHO any extension name should be reserved as a namespace. Ilia Alshanetsky On 30-Mar-09, at 7:56 PM, Paul Biggar wrote: On Tue, Mar 31, 2009 at 12:28 AM, Lukas Kahwe Smith > wrote: If nobody proposes something, this will just slide by .. It seems simple enough to add a note on the manual page reserving the use of some namespaces: PHP (even if we never use it, best no-one else does) internals (ditto) SPL (reserved for SPL) PEAR (reserved for PEAR) PECL (reserved for PECL) Though we could add a simple check to the parser, I see no real need if we make this list conspicuous enough. Once the users have been warned, we are in a better position to administer their kick to the nuts. Paul -- Paul Biggar paul.big...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
On Tue, Mar 31, 2009 at 12:28 AM, Lukas Kahwe Smith wrote: > If nobody proposes something, this will just slide by .. It seems simple enough to add a note on the manual page reserving the use of some namespaces: PHP (even if we never use it, best no-one else does) internals (ditto) SPL (reserved for SPL) PEAR (reserved for PEAR) PECL (reserved for PECL) Though we could add a simple check to the parser, I see no real need if we make this list conspicuous enough. Once the users have been warned, we are in a better position to administer their kick to the nuts. Paul -- Paul Biggar paul.big...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
On 13.03.2009, at 00:39, Andrei Zmievski wrote: Christian Schneider wrote: Things gettings reserved at a later stage (like originally keywords, now namespaces) can lead to a big deal of frustration. Therefore I think it is crucial to have a clear naming guide now. And these guidelines have to be noticed by everybody who starts to use namespaces so they have to be placed prominently. Personally I'd even prefer them to be enforced in code so they can't be missed. Removing restrictions later on causes less trouble so I wouldn't mind too much if a couple of namespaces (or namespace prefixes) are reserved but never used. Just a gentle reminder to make sure we don't miss this.. So where are we at here? If nobody proposes something, this will just slide by .. I guess we can say that there is a definate risk, that eventually extensions will become namespaced. Same for internal functions. So calling a namespace "Date" or "str" is probably not a good idea .. right? Now for the less obvious stuff .. does the ZF prefix all their top level namespaces with ZF etc.? Speaking of ZF ... wasnt there an effort over at ZF to define a sensible standard? regards, Lukas Kahwe Smith m...@pooteeweet.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
Lukas Kahwe Smith wrote: > > On 13.03.2009, at 00:39, Andrei Zmievski wrote: > >> Christian Schneider wrote: >>> Things gettings reserved at a later stage (like originally keywords, now >>> namespaces) can lead to a big deal of frustration. Therefore I think it >>> is crucial to have a clear naming guide now. >>> And these guidelines have to be noticed by everybody who starts to use >>> namespaces so they have to be placed prominently. >>> Personally I'd even prefer them to be enforced in code so they can't be >>> missed. >>> Removing restrictions later on causes less trouble so I wouldn't mind >>> too much if a couple of namespaces (or namespace prefixes) are reserved >>> but never used. >> >> Just a gentle reminder to make sure we don't miss this.. > > > Well cant we just use the class naming guide? As in put a prefix in your > namespace names, do not use an extension name (or something that could > likely become an extension name) as your prefix. > > Then again for classes we say that the prefix should be prepended with > an underscore as the separator as the ultimate protection. That of > course does not seem feasible for namespaces. -1 for using existing guide Please don't make us do this This is fine: Greg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
On 13.03.2009, at 00:39, Andrei Zmievski wrote: Christian Schneider wrote: Things gettings reserved at a later stage (like originally keywords, now namespaces) can lead to a big deal of frustration. Therefore I think it is crucial to have a clear naming guide now. And these guidelines have to be noticed by everybody who starts to use namespaces so they have to be placed prominently. Personally I'd even prefer them to be enforced in code so they can't be missed. Removing restrictions later on causes less trouble so I wouldn't mind too much if a couple of namespaces (or namespace prefixes) are reserved but never used. Just a gentle reminder to make sure we don't miss this.. Well cant we just use the class naming guide? As in put a prefix in your namespace names, do not use an extension name (or something that could likely become an extension name) as your prefix. Then again for classes we say that the prefix should be prepended with an underscore as the separator as the ultimate protection. That of course does not seem feasible for namespaces. regards, Lukas Kahwe Smith m...@pooteeweet.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
Christian Schneider wrote: Things gettings reserved at a later stage (like originally keywords, now namespaces) can lead to a big deal of frustration. Therefore I think it is crucial to have a clear naming guide now. And these guidelines have to be noticed by everybody who starts to use namespaces so they have to be placed prominently. Personally I'd even prefer them to be enforced in code so they can't be missed. Removing restrictions later on causes less trouble so I wouldn't mind too much if a couple of namespaces (or namespace prefixes) are reserved but never used. Just a gentle reminder to make sure we don't miss this.. -Andrei -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
Alain Williams wrote: > On Mon, Jan 26, 2009 at 01:06:01PM +0100, Christian Schneider wrote: >> Things gettings reserved at a later stage (like originally keywords, now >> namespaces) can lead to a big deal of frustration. Therefore I think it >> is crucial to have a clear naming guide now. > > +1 > >> And these guidelines have to be noticed by everybody who starts to use >> namespaces so they have to be placed prominently. > >> Personally I'd even prefer them to be enforced in code so they can't be >> missed. > > No: > * there are occasional times when rules might want to be broken > * to enforce it just makes the language/compiler bigger > * If it is advertised and someone breaks the rules - then it is their problem. > >> Removing restrictions later on causes less trouble so I wouldn't mind >> too much if a couple of namespaces (or namespace prefixes) are reserved >> but never used. > > As I suggested, do it the way that perl does: it is keyed off the case of the > characters. > So, the reserved spaces could be one of: > > 1) entirely lower case (or perhaps just start with lower case) > 2) entirely upper case People, can we all agree to remember that PHP is case-insensitive with the exception of variable names and a few constants? Thanks, Greg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
On Mon, Jan 26, 2009 at 01:06:01PM +0100, Christian Schneider wrote: > Things gettings reserved at a later stage (like originally keywords, now > namespaces) can lead to a big deal of frustration. Therefore I think it > is crucial to have a clear naming guide now. +1 > And these guidelines have to be noticed by everybody who starts to use > namespaces so they have to be placed prominently. > Personally I'd even prefer them to be enforced in code so they can't be > missed. No: * there are occasional times when rules might want to be broken * to enforce it just makes the language/compiler bigger * If it is advertised and someone breaks the rules - then it is their problem. > Removing restrictions later on causes less trouble so I wouldn't mind > too much if a couple of namespaces (or namespace prefixes) are reserved > but never used. As I suggested, do it the way that perl does: it is keyed off the case of the characters. So, the reserved spaces could be one of: 1) entirely lower case (or perhaps just start with lower case) 2) entirely upper case 3) start with an underscore ('_') Perl does (1). It might be better to do (2) because system variables tend to be in upper case anyway (think: $_GET). (3) also has the virtue that system things tend to start with an underscore. This scheme is nice and simple. -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php Past chairman of UKUUG: http://www.ukuug.org/ #include -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
Lukas Kahwe Smith wrote: > On 24.01.2009, at 00:49, Andrei Zmievski wrote: > >> Hannes Magnusson wrote: >>> I don't think we have to treat our users like a total fcking idiots. >>> If anyone thinks using "SPL" or "PHP" as their root namespace is a >>> good idea they deserve to be kicked in the nuts. >> >> And who's going to administer this kicking? > > I think the decision was to not yet bother with reserving namespaces or > starting to namespace-ify extensions. We might however want to put out a > naming guide for namespaces. Things gettings reserved at a later stage (like originally keywords, now namespaces) can lead to a big deal of frustration. Therefore I think it is crucial to have a clear naming guide now. And these guidelines have to be noticed by everybody who starts to use namespaces so they have to be placed prominently. Personally I'd even prefer them to be enforced in code so they can't be missed. Removing restrictions later on causes less trouble so I wouldn't mind too much if a couple of namespaces (or namespace prefixes) are reserved but never used. My two cents, - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
IMHO, the prefix will turn everything more readable... I already saw people experiencing some doubts regarding this piece of code. I had to illustrate it everything. namespace Foo; class Bar { public function test() { try { do_some_stuf(); } catch (Exception $e) { // Refers to Foo\Exception // Special handling of Foo Exception } catch (\Exception $e) { // Refers to PHP Exception // Special handling of Exception } } } I just updated the code to explain wtf is happening... but he was just trying to do a simple try { .. } catch (Exception $e) { ... } and thought it was a bug since it was refering to Foo\Exception. Sounds newbie, but you will have troubles in the future. Regards, On Fri, Jan 23, 2009 at 10:07 PM, Alain Williams wrote: > On Fri, Jan 23, 2009 at 03:58:22PM -0800, Andrei Zmievski wrote: >> Lukas Kahwe Smith wrote: >> >I think the decision was to not yet bother with reserving namespaces or >> >starting to namespace-ify extensions. We might however want to put out a >> >naming guide for namespaces. >> >> I agree. Whether the error is raised or not on reserved namespaces can be >> done later, but we should explicitly indicate that certain namespaces are >> off-limits. > > Could take the simple convention that exists in perl with modules. > > Module names begin with a capital letter, pragmase are lower case, thus you > have: > >use strict; > >use IO::File > > Nobody is made to do anything, however you loose the option to complain if > your > namespace starts with a lower case character. > > -- > Alain Williams > Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT > Lecturer. > +44 (0) 787 668 0256 http://www.phcomp.co.uk/ > Parliament Hill Computers Ltd. Registration Information: > http://www.phcomp.co.uk/contact.php > Past chairman of UKUUG: http://www.ukuug.org/ > #include > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Guilherme Blanco - Web Developer CBC - Certified Bindows Consultant Cell Phone: +55 (16) 9215-8480 MSN: guilhermebla...@hotmail.com URL: http://blog.bisna.com São Paulo - SP/Brazil -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
On Fri, Jan 23, 2009 at 03:58:22PM -0800, Andrei Zmievski wrote: > Lukas Kahwe Smith wrote: > >I think the decision was to not yet bother with reserving namespaces or > >starting to namespace-ify extensions. We might however want to put out a > >naming guide for namespaces. > > I agree. Whether the error is raised or not on reserved namespaces can be > done later, but we should explicitly indicate that certain namespaces are > off-limits. Could take the simple convention that exists in perl with modules. Module names begin with a capital letter, pragmase are lower case, thus you have: use strict; use IO::File Nobody is made to do anything, however you loose the option to complain if your namespace starts with a lower case character. -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php Past chairman of UKUUG: http://www.ukuug.org/ #include -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
Lukas Kahwe Smith wrote: I think the decision was to not yet bother with reserving namespaces or starting to namespace-ify extensions. We might however want to put out a naming guide for namespaces. I agree. Whether the error is raised or not on reserved namespaces can be done later, but we should explicitly indicate that certain namespaces are off-limits. -Andrei -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
On 24.01.2009, at 00:49, Andrei Zmievski wrote: Hannes Magnusson wrote: I don't think we have to treat our users like a total fcking idiots. If anyone thinks using "SPL" or "PHP" as their root namespace is a good idea they deserve to be kicked in the nuts. And who's going to administer this kicking? I think the decision was to not yet bother with reserving namespaces or starting to namespace-ify extensions. We might however want to put out a naming guide for namespaces. regards, Lukas Kahwe Smith m...@pooteeweet.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
Hannes Magnusson wrote: I don't think we have to treat our users like a total fcking idiots. If anyone thinks using "SPL" or "PHP" as their root namespace is a good idea they deserve to be kicked in the nuts. And who's going to administer this kicking? -Andrei -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
On Fri, Jan 23, 2009 at 23:14, Andrei Zmievski wrote: > Forgive me if I've missed this in the heat of all the namespaces > discussions. Did we consider having reserved namespaces, like 'PHP' or > 'SPL', so that if a user tries to declare a namespace with that name an > error is raised? I don't think we have to treat our users like a total fcking idiots. If anyone thinks using "SPL" or "PHP" as their root namespace is a good idea they deserve to be kicked in the nuts. -Hannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reserved namespaces
> Forgive me if I've missed this in the heat of all the namespaces > discussions. Did we consider having reserved namespaces, like 'PHP' or > 'SPL', so that if a user tries to declare a namespace with that name an > error is raised? I'd say what you are looking for is probably this. http://wiki.php.net/rfc/namespaces-for-internal-classes I know this has been discussed but I'm not sure if any decision has been made on that subject. Or if anyone had time to start digging into this issue further than discussions. Lars? Cheers, -- Slan, David -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php