Hi,
I've a few questions about the namespace patch:
-
Why is "import Foo" a no-op?
Shouldn't it import everything define inside Foo? -
How can I import all classes from a namespace at once?
Like question 1) actually. "import Foo::*" doesn't work. -
Shouldn't there be an error when importing a class which already
existing in the current scope? Example
---------------8<--------------------
ns2.php:
<?php
namespace Foo;
class Bar {
public function __construct() {
echo "Namespace class\n";
}
}
ns1.php:
<?php
require_once 'ns2.php';
class Bar {
public function __construct() {
echo "No namespace class\n";
}
}
import Foo::Bar;
new Bar;
C:...\Desktop\php6>php ns1.php
Namespace class
---------------8<--------------------
I read the thread an I know that I can still call access the global
class with ::Bar ... but is this a intuitive behaviour?
thanks,
- Markus
- Why is "import Foo" a no-op?
Shouldn't it import everything define inside Foo?
No, it shouldn't.
- How can I import all classes from a namespace at once?
Use namespace::class.
- Shouldn't there be an error when importing a class which already
existing in the current scope? Example
I think there should be.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
- How can I import all classes from a namespace at once?
Use namespace::class.
That's not the answer to the question. Markus was asking how to import
all classes from a namespace at once.
Derick
--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org
And that's exactly why this implementation isn't intuitive. As far as I
can see from the way it's been explained, so far, that is not possible.
Jeremy
-----Original Message-----
From: Derick Rethans [mailto:derick@php.net]
Sent: Monday, July 23, 2007 12:55 AM
To: Stanislav Malyshev
Cc: Markus Fischer; internals
Subject: Re: [PHP-DEV] Question about Namespace patch
- How can I import all classes from a namespace at once?
Use namespace::class.
That's not the answer to the question. Markus was asking how to import
all classes from a namespace at once.
Derick
--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org
And that's exactly why this implementation isn't intuitive. As far as I
can see from the way it's been explained, so far, that is not possible.
No implementation is "intuitive", unless by "intuitive" you mean "works
as in that other language I know". Too bad in each of these languages it
works differently :)
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav,
Absolutely not the case. Take a look at C++, C#, even Python. The
"namespaces" implementation of those languages is mostly consistent
(even if Python doesn't call it that).
You're not helping developers at all with this implementation. If you're
working with a large library and have to import a lot of classes, the
way this works is nothing but a pain. We would be better off not using
namespaces at all, in this case. Thus, the problem has not been solved.
Also, for the implementation to be complete, Core Developers and
Extension Developers would need to namespace their classes / functions.
And that, undoubtedly, is a LOT of work. I can understand this being the
justification for implementing namespaces in the way it's been
implemented, because all of this other stuff in the global namespace,
but you still need to offer developers some way of importing
everything out of a namespace. I absolutely will have upwards to close
to 25 - 30 classes in a single namespace. And sometimes more. To be able
to import them all is an absolute necessity for this implementation to
be remotely feasible. Having an import block at the top of files that's
that huge just doesn't make any sense. And that doesn't even consider
the fact that I may be using OTHER libraries as well that may be
namespaced.
PEAR is a perfect example of this. Look at all the libraries that exist
there. I would absolutely love to just:
import PEAR;
import PEAR::HTTP;
import PEAR::Image;
And not have to worry about going through and picking out every little
individual class that I need. And with all of the languages I mentioned
before, that is exactly how it works. Of course, we're back to the
namespacing of the PHP Core and Extensions. Which is really the main
blocker to any serious namespaces implementation, beyond what's
currently patched to HEAD today, correct?
I hope you can better see my viewpoint, now that I actually had the time
to sit down and type out a more coherent reply. This implementation and
the unicode.semantics discussion have to be the most frustrating points
PHP6 has for me, right now.
Thanks.
Jeremy Privett
Software Developer
Peak8 Solutions
-----Original Message-----
From: Stanislav Malyshev [mailto:stas@zend.com]
Sent: Monday, July 23, 2007 1:39 AM
To: Jeremy Privett
Cc: Derick Rethans; Markus Fischer; internals
Subject: Re: [PHP-DEV] Question about Namespace patch
And that's exactly why this implementation isn't intuitive. As far as
I
can see from the way it's been explained, so far, that is not
possible.
No implementation is "intuitive", unless by "intuitive" you mean "works
as in that other language I know". Too bad in each of these languages it
works differently :)
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
In reality, it is rarely (almost never) needed to import all the
classes. Usually you need 2–4 per file, not more, and importing just
what you really need is the step to a clean design.
You don't need to import every class which is used implicitly, only
those which are explicitly used.
Stanislav,
Absolutely not the case. Take a look at C++, C#, even Python. The
"namespaces" implementation of those languages is mostly consistent
(even if Python doesn't call it that).You're not helping developers at all with this implementation. If you're
working with a large library and have to import a lot of classes, the
way this works is nothing but a pain. We would be better off not using
namespaces at all, in this case. Thus, the problem has not been solved.Also, for the implementation to be complete, Core Developers and
Extension Developers would need to namespace their classes / functions.
And that, undoubtedly, is a LOT of work. I can understand this being the
justification for implementing namespaces in the way it's been
implemented, because all of this other stuff in the global namespace,
but you still need to offer developers some way of importing
everything out of a namespace. I absolutely will have upwards to close
to 25 - 30 classes in a single namespace. And sometimes more. To be able
to import them all is an absolute necessity for this implementation to
be remotely feasible. Having an import block at the top of files that's
that huge just doesn't make any sense. And that doesn't even consider
the fact that I may be using OTHER libraries as well that may be
namespaced.PEAR is a perfect example of this. Look at all the libraries that exist
there. I would absolutely love to just:import PEAR;
import PEAR::HTTP;
import PEAR::Image;And not have to worry about going through and picking out every little
individual class that I need. And with all of the languages I mentioned
before, that is exactly how it works. Of course, we're back to the
namespacing of the PHP Core and Extensions. Which is really the main
blocker to any serious namespaces implementation, beyond what's
currently patched to HEAD today, correct?I hope you can better see my viewpoint, now that I actually had the time
to sit down and type out a more coherent reply. This implementation and
the unicode.semantics discussion have to be the most frustrating points
PHP6 has for me, right now.Thanks.
Jeremy Privett
Software Developer
Peak8 Solutions-----Original Message-----
From: Stanislav Malyshev [mailto:stas@zend.com]
Sent: Monday, July 23, 2007 1:39 AM
To: Jeremy Privett
Cc: Derick Rethans; Markus Fischer; internals
Subject: Re: [PHP-DEV] Question about Namespace patchAnd that's exactly why this implementation isn't intuitive. As far as
I
can see from the way it's been explained, so far, that is not
possible.No implementation is "intuitive", unless by "intuitive" you mean "works
as in that other language I know". Too bad in each of these languages itworks differently :)
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com--
--
Alexey Zakhlestin
http://blog.milkfarmsoft.com/
Alexey,
I honestly wish that were the case with the situation I'm dealing with
at my current job. And I know a lot of people that are absolutely in the
same boat as I am.
I definitely understand your reasoning here, but we're obviously talking
about design versus convenience. This is one of those situations where
convenience makes the difference.
Was there ever a decision on whether or not the patch is going to be
backported to PHP5? I think I'll grab a PHP6 snapshot and toy around
with the implementation a bit. Who knows ... it may grow on me. We'll
see.
Thanks.
Jeremy Privett
Software Developer
Peak8 Solutions
-----Original Message-----
From: Alexey Zakhlestin [mailto:indeyets@gmail.com]
Sent: Monday, July 23, 2007 2:14 AM
To: Jeremy Privett
Cc: Stanislav Malyshev; Derick Rethans; Markus Fischer; internals
Subject: Re: [PHP-DEV] Question about Namespace patch
In reality, it is rarely (almost never) needed to import all the
classes. Usually you need 2-4 per file, not more, and importing just
what you really need is the step to a clean design.
You don't need to import every class which is used implicitly, only
those which are explicitly used.
Stanislav,
Absolutely not the case. Take a look at C++, C#, even Python. The
"namespaces" implementation of those languages is mostly consistent
(even if Python doesn't call it that).You're not helping developers at all with this implementation. If
you're
working with a large library and have to import a lot of classes, the
way this works is nothing but a pain. We would be better off not using
namespaces at all, in this case. Thus, the problem has not been
solved.Also, for the implementation to be complete, Core Developers and
Extension Developers would need to namespace their classes /
functions.
And that, undoubtedly, is a LOT of work. I can understand this being
the
justification for implementing namespaces in the way it's been
implemented, because all of this other stuff in the global namespace,
but you still need to offer developers some way of importing
everything out of a namespace. I absolutely will have upwards to close
to 25 - 30 classes in a single namespace. And sometimes more. To be
able
to import them all is an absolute necessity for this implementation to
be remotely feasible. Having an import block at the top of files
that's
that huge just doesn't make any sense. And that doesn't even consider
the fact that I may be using OTHER libraries as well that may be
namespaced.PEAR is a perfect example of this. Look at all the libraries that
exist
there. I would absolutely love to just:import PEAR;
import PEAR::HTTP;
import PEAR::Image;And not have to worry about going through and picking out every little
individual class that I need. And with all of the languages I
mentioned
before, that is exactly how it works. Of course, we're back to the
namespacing of the PHP Core and Extensions. Which is really the main
blocker to any serious namespaces implementation, beyond what's
currently patched to HEAD today, correct?I hope you can better see my viewpoint, now that I actually had the
time
to sit down and type out a more coherent reply. This implementation
and
the unicode.semantics discussion have to be the most frustrating
points
PHP6 has for me, right now.Thanks.
Jeremy Privett
Software Developer
Peak8 Solutions-----Original Message-----
From: Stanislav Malyshev [mailto:stas@zend.com]
Sent: Monday, July 23, 2007 1:39 AM
To: Jeremy Privett
Cc: Derick Rethans; Markus Fischer; internals
Subject: Re: [PHP-DEV] Question about Namespace patchAnd that's exactly why this implementation isn't intuitive. As far
as
I
can see from the way it's been explained, so far, that is not
possible.No implementation is "intuitive", unless by "intuitive" you mean
"works
as in that other language I know". Too bad in each of these languages
itworks differently :)
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com--
--
Alexey Zakhlestin
http://blog.milkfarmsoft.com/
In reality, it is rarely (almost never) needed to import all the
classes. Usually you need 2â4 per file, not more, and importing just
what you really need is the step to a clean design.You don't need to import every class which is used implicitly, only
those which are explicitly used.
I've run into "enough" cases in several languages/projects over the
years where I end up using damn near every class/function in a
moderate-sized library.
And you'd certainly want to do that if you're, say, writing some kind
of higher-level glue-wrapper API sort of thing -- which is a not
uncommon use-case.
While it may not meet the 90% rule, it's super-painful for that 10%
for any decent-sized library :-(
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
Absolutely not the case. Take a look at C++, C#, even Python. The
"namespaces" implementation of those languages is mostly consistent
(even if Python doesn't call it that).
Come on, python modules are not like C++ namespaces at all. For
starters, AFAIK, python doesn't even have namespace declaration
operator. And module loading and namespacing are combined.
You're not helping developers at all with this implementation. If you're
How many developers did you ask, honestly? I had asked some, and they
say it helps. Including on the list. You wanted to say I'm not helping
some other developers? Well, too bad, there's no patch that can solve
everybody's problems :)
working with a large library and have to import a lot of classes, the
way this works is nothing but a pain. We would be better off not using
namespaces at all, in this case. Thus, the problem has not been solved.
Once more, you DO NOT have to import a lot of classes. Please do read
what I write. You SHOULD NOT import classes in global space. Namespaces
are NOT the way to bring all classes in global space, and it should not
be done.
Also, for the implementation to be complete, Core Developers and
Extension Developers would need to namespace their classes / functions.
Not necessarily. So far PHP core & PECL has been OK without it, there's
not too many classes and the names are quite manageable, unless I miss
something.
but you still need to offer developers some way of importing
everything out of a namespace. I absolutely will have upwards to close
No, I don't need that.
to 25 - 30 classes in a single namespace. And sometimes more. To be able
to import them all is an absolute necessity for this implementation to
No, it is not an absolute necessity, actually it's exactly the opposite.
You don't want each module to inject 30 new names into global space,
because you'll be running out of names very, very fast.
the fact that I may be using OTHER libraries as well that may be
namespaced.PEAR is a perfect example of this. Look at all the libraries that exist
there. I would absolutely love to just:import PEAR;
import PEAR::HTTP;
import PEAR::Image;
Yeah, and not since you have generic PEAR exception class, HTTP
exception class and image exception class, you've got three exception
classes competing with system exception class for the name. Lovely. So
now we get PEAR::PEAR_Exception to prevent that, right? So how it's
better than just PEAR::Exception?
individual class that I need. And with all of the languages I mentioned
before, that is exactly how it works. Of course, we're back to the
No, actually it doesn't. In python import - and that's what most use -
doesn't bring names into global space.
namespacing of the PHP Core and Extensions. Which is really the main
blocker to any serious namespaces implementation, beyond what's
currently patched to HEAD today, correct?
No, incorrect. The main blocker was that all other implementations were
either inconsistent, hurting performance or too complex for PHP.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav Malyshev wrote:
working with a large library and have to import a lot of classes, the
way this works is nothing but a pain. We would be better off not using
namespaces at all, in this case. Thus, the problem has not been solved.Once more, you DO NOT have to import a lot of classes. Please do read
what I write. You SHOULD NOT import classes in global space. Namespaces
are NOT the way to bring all classes in global space, and it should not
be done.
OK, so suppose I want to have four namespaces for my project:
MyApp for some shared code,
MyApp::Model
MyApp::Controller
MyApp::View
Now in many places in my code in Model I'd use some ORM library - let's assume
it's similar to python's SQLAlchemy. Now is there any way for me to have
access in Model namespace to all classes from SQLAlchemy namespace
without using
import SQLAlchemy::Column
import SQLAlchemy::Table
import SQLAlchemy::Join
import SQLAlchemy::ForeignKey
import SQLAlchemy::Session
import SQLAlchemy::Transaction
and tens of other classes? I know your patch makes it possible to use fully
qualified names everywhere.
--
Paweł Stradomski
import SQLAlchemy::Column
import SQLAlchemy::Table
import SQLAlchemy::Join
import SQLAlchemy::ForeignKey
import SQLAlchemy::Session
import SQLAlchemy::Transaction
Why use namespaces if you are going to do this? You are just bringing
your classes into the global name space. The nice thing about
namespaces IMO, is that I don't have to have a class named
SQLAlchemy_Transaction. I can just have a class named Transaction in
the SQLAlchemy namespace. I can then create a new object using $obj =
new SQLAlchemy::Transaction.
--
Brian Moon
Senior Developer
http://dealnews.com/
It's good to be cheap =)
Am 23.07.2007 um 16:25 schrieb Brian Moon:
import SQLAlchemy::Column
import SQLAlchemy::Table
import SQLAlchemy::Join
import SQLAlchemy::ForeignKey
import SQLAlchemy::Session
import SQLAlchemy::TransactionWhy use namespaces if you are going to do this? You are just
bringing your classes into the global name space. The nice thing
about namespaces IMO, is that I don't have to have a class named
SQLAlchemy_Transaction. I can just have a class named Transaction
in the SQLAlchemy namespace. I can then create a new object using
$obj = new SQLAlchemy::Transaction.
Oh yes, sure, that must be the main point about namespaces - I can
use "::" instead of "_" as a delimiter! Yay!
Come on, you can't be serious.
David
Am 23.07.2007 um 16:25 schrieb Brian Moon:
import SQLAlchemy::Column
import SQLAlchemy::Table
import SQLAlchemy::Join
import SQLAlchemy::ForeignKey
import SQLAlchemy::Session
import SQLAlchemy::TransactionWhy use namespaces if you are going to do this? You are just bringing your
classes into the global name space. The nice thing about namespaces IMO, is
that I don't have to have a class named SQLAlchemy_Transaction. I can just
have a class named Transaction in the SQLAlchemy namespace. I can then
create a new object using $obj = new SQLAlchemy::Transaction.Oh yes, sure, that must be the main point about namespaces - I can use "::"
instead of "_" as a delimiter! Yay!
You forgot that you can also move the "prefix" in front of the class
name to "namespace prefix!"
Come on, you can't be serious.
I sort of agree, I don't see how the current implementation is really
useful for anything.
regards,
Derick
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org
Derick Rethans wrote:
I sort of agree, I don't see how the current implementation is really
useful for anything.
Well, for us, it would be useful for using 3rd party applications with
our internally written code. We have mostly a functional (as in C not
as in BASIC) environment. Recently we wanted to use Wordpress and
MediaWiki for an internal project. We had to drudge through THEIR code
and the error logs to find all the functions that conflicted with ones
in our own code library.
Now, if we had this namespaces implementation, we could namespace all of
our internal code with a namespace of dealnews and ideally those
projects would namespace their projects. This way there would be no
conflicts in the global scope.
Now, in Phorum, we did it the hard way and have hundreds of phorum_*
functions. It makes for some really bad reading code with those huge
function names.
I guess what this comes down to is that these namespaces are better for
project wide things and not so good at smaller parts. I agree that I
would not want to work with 50 different namespaces with this solution.
But, I would never work with 50 different namespaces as I don't find
that type of organization useful.
--
Brian Moon
Senior Developer
http://dealnews.com/
It's good to be cheap =)
Despite all the comments made on this list by countless people, it's still
Stanislav's way or the highway. I don't want to sound negative but come
on... this is getting ridiculous. Stanislav, why don't you just tell
everybody that you'll stop answering because the patch will stay AS IT IS
over your dead body anyway ? I think you'll save us all some time.
This discussion is endless and not productive. I can't speak for anybody
here but I think a vote by all people who have commit access to php-src
would clarify this issue once and for all so we can just move along.
But that's just my 2 cents.
Am 23.07.2007 um 16:25 schrieb Brian Moon:
import SQLAlchemy::Column
import SQLAlchemy::Table
import SQLAlchemy::Join
import SQLAlchemy::ForeignKey
import SQLAlchemy::Session
import SQLAlchemy::TransactionWhy use namespaces if you are going to do this? You are just bringing
your
classes into the global name space. The nice thing about namespaces
IMO, is
that I don't have to have a class named SQLAlchemy_Transaction. I can
just
have a class named Transaction in the SQLAlchemy namespace. I can
then
create a new object using $obj = new SQLAlchemy::Transaction.Oh yes, sure, that must be the main point about namespaces - I can use
"::"
instead of "_" as a delimiter! Yay!You forgot that you can also move the "prefix" in front of the class
name to "namespace prefix!"Come on, you can't be serious.
I sort of agree, I don't see how the current implementation is really
useful for anything.regards,
DerickDerick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org--
--
Nicolas Bérard-Nault (nicobn@gmail.com)
Étudiant D.E.C. Sciences, Lettres & Arts
Cégep de Sherbrooke
Homepage: http://nicobn.googlepages.com
Yes, because that's ABSOLUTELY the way to respond to the community that has continued to support PHP. If that is what this discussion is going to degrade to, you're essentially saying "Please, gives us feedback but we're not listening."
If this is the case, then I'll keep in mind and make sure it's known that bringing your issues and feedback to the PHP Devs is such a lovely waste of time and energy.
Thanks.
Jeremy Privett
Software Developer
Peak8 Solutions
-----Original Message-----
From: nicobn@gmail.com [mailto:nicobn@gmail.com] On Behalf Of Nicolas Bérard-Nault
Sent: Monday, July 23, 2007 10:03 AM
To: Derick Rethans
Cc: David Zülke; PHP Internals
Subject: Re: [PHP-DEV] Question about Namespace patch
Despite all the comments made on this list by countless people, it's still
Stanislav's way or the highway. I don't want to sound negative but come
on... this is getting ridiculous. Stanislav, why don't you just tell
everybody that you'll stop answering because the patch will stay AS IT IS
over your dead body anyway ? I think you'll save us all some time.
This discussion is endless and not productive. I can't speak for anybody
here but I think a vote by all people who have commit access to php-src
would clarify this issue once and for all so we can just move along.
But that's just my 2 cents.
Am 23.07.2007 um 16:25 schrieb Brian Moon:
import SQLAlchemy::Column
import SQLAlchemy::Table
import SQLAlchemy::Join
import SQLAlchemy::ForeignKey
import SQLAlchemy::Session
import SQLAlchemy::TransactionWhy use namespaces if you are going to do this? You are just bringing
your
classes into the global name space. The nice thing about namespaces
IMO, is
that I don't have to have a class named SQLAlchemy_Transaction. I can
just
have a class named Transaction in the SQLAlchemy namespace. I can
then
create a new object using $obj = new SQLAlchemy::Transaction.Oh yes, sure, that must be the main point about namespaces - I can use
"::"
instead of "_" as a delimiter! Yay!You forgot that you can also move the "prefix" in front of the class
name to "namespace prefix!"Come on, you can't be serious.
I sort of agree, I don't see how the current implementation is really
useful for anything.regards,
DerickDerick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org--
--
Nicolas Bérard-Nault (nicobn@gmail.com)
Étudiant D.E.C. Sciences, Lettres & Arts
Cégep de Sherbrooke
Homepage: http://nicobn.googlepages.com
Yes, because that's ABSOLUTELY the way to respond to the community that has continued to support PHP. If that is what this discussion is going to degrade to, you're essentially saying "Please, gives us feedback but we're not listening."
If this is the case, then I'll keep in mind and make sure it's known that bringing your issues and feedback to the PHP Devs is such a lovely waste of time and energy.
Thanks.
Jeremy Privett
Software Developer
Peak8 Solutions-----Original Message-----
From: nicobn@gmail.com [mailto:nicobn@gmail.com] On Behalf Of Nicolas Bérard-Nault
Sent: Monday, July 23, 2007 10:03 AM
To: Derick Rethans
Cc: David Zülke; PHP Internals
Subject: Re: [PHP-DEV] Question about Namespace patchDespite all the comments made on this list by countless people, it's still
Stanislav's way or the highway. I don't want to sound negative but come
on... this is getting ridiculous. Stanislav, why don't you just tell
everybody that you'll stop answering because the patch will stay AS IT IS
over your dead body anyway ? I think you'll save us all some time.This discussion is endless and not productive. I can't speak for anybody
here but I think a vote by all people who have commit access to php-src
would clarify this issue once and for all so we can just move along.But that's just my 2 cents.
Am 23.07.2007 um 16:25 schrieb Brian Moon:
import SQLAlchemy::Column
import SQLAlchemy::Table
import SQLAlchemy::Join
import SQLAlchemy::ForeignKey
import SQLAlchemy::Session
import SQLAlchemy::TransactionWhy use namespaces if you are going to do this? You are just bringing
your
classes into the global name space. The nice thing about namespaces
IMO, is
that I don't have to have a class named SQLAlchemy_Transaction. I can
just
have a class named Transaction in the SQLAlchemy namespace. I can
then
create a new object using $obj = new SQLAlchemy::Transaction.Oh yes, sure, that must be the main point about namespaces - I can use
"::"
instead of "_" as a delimiter! Yay!You forgot that you can also move the "prefix" in front of the class
name to "namespace prefix!"Come on, you can't be serious.
I sort of agree, I don't see how the current implementation is really
useful for anything.regards,
DerickDerick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org--
--
Nicolas Bérard-Nault (nicobn@gmail.com)
Étudiant D.E.C. Sciences, Lettres & Arts
Cégep de SherbrookeHomepage: http://nicobn.googlepages.com
--
Plus ca change, plus c'est pareil.
--
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com)
51.42.06.70.18
Yes, because that's ABSOLUTELY the way to respond to the community
that has continued to support PHP. If that is what this discussion is
going to degrade to, you're essentially saying "Please, gives us
feedback but we're not listening."
I responded - with arguments, explanation or reference to prior
arguments - to every comment on the list. It is hardly "not listening".
Maybe "not agreeing" - but nobody promised you to agree with everything
you say here. It's not what "feedback" means. It means you will be
listened to, your proposals would be weighted, discusses and seriously
considered. That is what you are getting. I can not promise you
immediate acceptance - and nobody would.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
I wasn't referring to that. I know you've been responding to feedback. I was referring to Nicolas' suggested reply.
Jeremy Privett
Software Developer
Peak8 Solutions
-----Original Message-----
From: Stanislav Malyshev [mailto:stas@zend.com]
Sent: Monday, July 23, 2007 10:43 AM
To: Jeremy Privett
Cc: Nicolas Bérard-Nault; Derick Rethans; David Zülke; PHP Internals
Subject: Re: [PHP-DEV] Question about Namespace patch
Yes, because that's ABSOLUTELY the way to respond to the community
that has continued to support PHP. If that is what this discussion is
going to degrade to, you're essentially saying "Please, gives us
feedback but we're not listening."
I responded - with arguments, explanation or reference to prior
arguments - to every comment on the list. It is hardly "not listening".
Maybe "not agreeing" - but nobody promised you to agree with everything
you say here. It's not what "feedback" means. It means you will be
listened to, your proposals would be weighted, discusses and seriously
considered. That is what you are getting. I can not promise you
immediate acceptance - and nobody would.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Despite all the comments made on this list by countless people, it's still
Stanislav's way or the highway. I don't want to sound negative but come
No it isn't. If you failed to make convincing argument on one particular
case, it in no way means that I am deaf to any argument at all - it just
means your particular argument didn't convince me as of yet.
on... this is getting ridiculous. Stanislav, why don't you just tell
everybody that you'll stop answering because the patch will stay AS IT IS
over your dead body anyway ? I think you'll save us all some time.
Because it's not true. We consulted with many people before this
proposal, and we got positive feedbacks from yet more people after we
made this proposal. Of course, there are people that have different
opinion. But there's a difference between discussing opinions and
dismissing other's opinion as illogical brain-dead stubbornness. I think
I took a lot of effort in explaining my position - in many cases much
more than opposing side did, when some people pretty much summed up with
"your proposal is crap, it's not like Java, so I have no use for it". I
will continue to put an effort in explaining. I however would not change
my position just because somebody feels sore when his argument turns out
not be as persuasive as he thought it would be.
This discussion is endless and not productive. I can't speak for anybody
Make it productive. Propose something productive. By that I mean a
consistent concept that will be superior to existing one. Or at least a
consistent amendment to existing concept that would improve it.
here but I think a vote by all people who have commit access to php-src
would clarify this issue once and for all so we can just move along.
I don't think these issues have to be decided by arithmetics. Of course,
writing "+1" is much easier than spending a month on researching
possible solution, considering all implications of each one and figuring
out the optimal one - but I don't see any value in the former unless the
latter was done. That doesn't mean expressing an opinion is to be
discouraged - but there's more than sum of +1-es to make an informed
decision that is going to influence PHP for years to come. I welcome
everybody to make a contribution and discuss things - but please do not
assume if you have an opinion everybody would agree.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
I agree with some (if not most) of your positions on namespaces and I do
think the work you've put on this issue is valuable. However, I just fail to
see who, other than people with karma on php-src (and that excludes me)
could decide what the implementation will be in the end.
In the end, I think you're right though, some people will not like it and
some will. That's how painful life is. Sorry if I was too harsh on you.
Despite all the comments made on this list by countless people, it's
still
Stanislav's way or the highway. I don't want to sound negative but comeNo it isn't. If you failed to make convincing argument on one particular
case, it in no way means that I am deaf to any argument at all - it just
means your particular argument didn't convince me as of yet.on... this is getting ridiculous. Stanislav, why don't you just tell
everybody that you'll stop answering because the patch will stay AS IT
IS
over your dead body anyway ? I think you'll save us all some time.Because it's not true. We consulted with many people before this
proposal, and we got positive feedbacks from yet more people after we
made this proposal. Of course, there are people that have different
opinion. But there's a difference between discussing opinions and
dismissing other's opinion as illogical brain-dead stubbornness. I think
I took a lot of effort in explaining my position - in many cases much
more than opposing side did, when some people pretty much summed up with
"your proposal is crap, it's not like Java, so I have no use for it". I
will continue to put an effort in explaining. I however would not change
my position just because somebody feels sore when his argument turns out
not be as persuasive as he thought it would be.This discussion is endless and not productive. I can't speak for anybody
Make it productive. Propose something productive. By that I mean a
consistent concept that will be superior to existing one. Or at least a
consistent amendment to existing concept that would improve it.here but I think a vote by all people who have commit access to php-src
would clarify this issue once and for all so we can just move along.I don't think these issues have to be decided by arithmetics. Of course,
writing "+1" is much easier than spending a month on researching
possible solution, considering all implications of each one and figuring
out the optimal one - but I don't see any value in the former unless the
latter was done. That doesn't mean expressing an opinion is to be
discouraged - but there's more than sum of +1-es to make an informed
decision that is going to influence PHP for years to come. I welcome
everybody to make a contribution and discuss things - but please do not
assume if you have an opinion everybody would agree.Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
--
Nicolas Bérard-Nault (nicobn@gmail.com)
Étudiant D.E.C. Sciences, Lettres & Arts
Cégep de Sherbrooke
Homepage: http://nicobn.googlepages.com
I agree with some (if not most) of your positions on namespaces and I do
think the work you've put on this issue is valuable. However, I just
fail to see who, other than people with karma on php-src (and that
excludes me) could decide what the implementation will be in the end.
I agree, but I don't agree that sum of votes is a good way to reach a
good decision in this case.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Despite all the comments made on this list by countless people, it's still
Stanislav's way or the highway. I don't want to sound negative but come
on... this is getting ridiculous. Stanislav, why don't you just tell
everybody that you'll stop answering because the patch will stay AS IT IS
over your dead body anyway ? I think you'll save us all some time.
There is no need to start attacking people so directly. Please keep it
civilized.
Derick
--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org
Brian Moon wrote
import SQLAlchemy::Column
import SQLAlchemy::Table
import SQLAlchemy::Join
import SQLAlchemy::ForeignKey
import SQLAlchemy::Session
import SQLAlchemy::TransactionWhy use namespaces if you are going to do this? You are just bringing
your classes into the global name space. The nice thing about
namespaces IMO, is that I don't have to have a class named
SQLAlchemy_Transaction. I can just have a class named Transaction in
the SQLAlchemy namespace. I can then create a new object using $obj =
new SQLAlchemy::Transaction.
Because I just want those names directly available in one part of my
application - the one which uses a lot of SQL. As far as I see this is not
possibl with the proposed implementation - I can't do a local (file-scope or
namespace-scope) import.
All other languages I know that have namespaces (Java, python, C++) allow
programmers to import other namespaces locally - usually for a single file.
--
Paweł Stradomski
Because I just want those names directly available in one part of my
application - the one which uses a lot of SQL. As far as I see this is not
If you want names to be part of global space - don't use namespaces.
Namespaces are meant to take names OUT of global space.
All other languages I know that have namespaces (Java, python, C++) allow
programmers to import other namespaces locally - usually for a single file.
Both Java and Python have much more rigid relations to files than PHP
does - in Java, class is file, more or less, and package is directory,
while in Python module is file and package is directory. Also, Java is a
compiled language - meaning you have much more information in compile
time than with PHP - all classes you use are to be known compile-time.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav Malyshev wrote:
Because I just want those names directly available in one part of my
application - the one which uses a lot of SQL. As far as I see this is
notIf you want names to be part of global space - don't use namespaces.
Namespaces are meant to take names OUT of global space.
Once again. I do not want classes/function from ORM lib to clutter my global
namespace everywhere. I just want everything from it to be available in
couple of files (where lots of SQL/mapping) is going to be used. In those few
files I'll be able to keep control of names and avoid conflicts.
Sure, I can prefix all the names or insert a bunch of imports, although it'll
just be ugly.
And about "not using namespaces" - there are such things as code libraries.
Those will probalby be namespaced - so I'll be using namespaces even in small
scripts - just because I'll be using those libs.
If using a bunch of imports is the only way that is accepted - then at least a
shortcut like python's "from x import a,b,c,d,e,f,g,h" would be a nice.
--
Paweł Stradomski
Once again. I do not want classes/function from ORM lib to clutter my global
namespace everywhere. I just want everything from it to be available in
couple of files (where lots of SQL/mapping) is going to be used. In those few
files I'll be able to keep control of names and avoid conflicts.
Sure, I can prefix all the names or insert a bunch of imports, although it'll
just be ugly.
Maybe if you use a really hairy ORM with a real lot of levels with real
lot of namespaces on each level which you all need it might be a bit
ugly. It's the same in other languages too - Java and Python code is no
stranger to a bunch of imports at the start of the file. And BTW if you
have such library structure blanket imports won't help you either since
you'd have to do a bunch of imports to capture all the levels.
If using a bunch of imports is the only way that is accepted - then at least a
shortcut like python's "from x import a,b,c,d,e,f,g,h" would be a nice.
Supporting comma syntax to group imports is probably a good idea, should
hurt anything. As for supporting "from X import A, B, C" - I guess this
is to mean "import X::A, X::B, X::C" - we need to think about it.
Anyway, there's always an option of just using X::A, X::B and X::C -
remember, putting things in global space is not a requirement, prefix is
OK. What is not OK is a overly long prefix.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Because I just want those names directly available in one part of my
application - the one which uses a lot of SQL. As far as I see this is notIf you want names to be part of global space - don't use namespaces.
Namespaces are meant to take names OUT of global space.All other languages I know that have namespaces (Java, python, C++) allow
programmers to import other namespaces locally - usually for a single
file.Both Java and Python have much more rigid relations to files than PHP
does - in Java, class is file, more or less, and package is directory,
Is this something that you would consider for PHP ?
As far as I can tell from the list the two main considerations are not
pushing the decision to the executor and it being simple.
Would this not satisfy all of the above. At compile time you could
import everything and still know where it came from because ultimately
you have the namespace from the location of the file.
Its pretty easy to explain, you did it in one line, and it would solve
other peoples issues with namespaces without polluting the global
namespace.
The only downside is that this now requires a 1 class / file. This
IMHO isn't a massive problem as long as it can be explained, and those
who have the task of splitting this up now can do an import Foo::*; ?
thoughts?
Andrew
while in Python module is file and package is directory. Also, Java is a
compiled language - meaning you have much more information in compile
time than with PHP - all classes you use are to be known compile-time.Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Is this something that you would consider for PHP ?
As far as I can tell from the list the two main considerations are not
pushing the decision to the executor and it being simple.
I can consider it as much as I want - and applications like Zend
Framework do work this way - but I also know not everybody works this
way. In fact, I get requests right here for having all code of whole
library handled as single file...
The only downside is that this now requires a 1 class / file. This
IMHO isn't a massive problem as long as it can be explained, and those
who have the task of splitting this up now can do an import Foo::*; ?
I don't see any imports involving * happening, since they all have a
common problem - you don't know what you are importing. Fortunately,
they also are completely unnecessary - if you need all things inside
Foo, why won't you just refer to them as Foo::things?
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Well i'm not in favour of the importing of everything , i don't see
the need for it personally but others do, as you well know. I was just
trying to find a way to achieve everyone goals without sacrificing
speed or correctness for those who want it =)
Shame about the single file thing though. I'm out of ideas, so best of luck :)
Andrew
Is this something that you would consider for PHP ?
As far as I can tell from the list the two main considerations are not
pushing the decision to the executor and it being simple.I can consider it as much as I want - and applications like Zend
Framework do work this way - but I also know not everybody works this
way. In fact, I get requests right here for having all code of whole
library handled as single file...The only downside is that this now requires a 1 class / file. This
IMHO isn't a massive problem as long as it can be explained, and those
who have the task of splitting this up now can do an import Foo::*; ?I don't see any imports involving * happening, since they all have a
common problem - you don't know what you are importing. Fortunately,
they also are completely unnecessary - if you need all things inside
Foo, why won't you just refer to them as Foo::things?Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
- How can I import all classes from a namespace at once?
Use namespace::class.That's not the answer to the question. Markus was asking how to import
all classes from a namespace at once.
That IS the answer. You don't. You use namespace::class instead. The
whole purpose was to get them OUT of the global space, no reason to
bring them back in.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
- How can I import all classes from a namespace at once?
Use namespace::class.That's not the answer to the question. Markus was asking how to
import
all classes from a namespace at once.That IS the answer. You don't. You use namespace::class instead. The
whole purpose was to get them OUT of the global space, no reason to
bring them back in.
I have to say that often I'd just as soon suck the whole library in if
it's a small enough project and I'm only using 1 library.
I don't really want to type FullyQualifiedLibname:: a zillion times...
I personally am not a zealot about getting things out of global
namespace -- I just want the dang libraries to be able to not conflict
when I used two and they both decided to call something 'Date'. :-)
I'll then want to pull in the whole library that I use the "most" and
use a fully-qualified name for the one I use the "least"
Maybe that's just me, but I suspect it's actually pretty common.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?