RE: [PHP-DEV] Simple Namespace Proposal
| From: | Dmitry Stogov | Date: | Fri, 06 Jul 2007 23:13:27 +0000 |
| Subject: | RE: [PHP-DEV] Simple Namespace Proposal | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-30577@lists.php.net to get a copy of this message | ||
One file may contain only one namespace and nothing else.
Several files may have the same namespace.
Dmitry.
> -----Original Message-----
> From: david.coallier@gmail.com
> [mailto:david.coallier@gmail.com] On Behalf Of David Coallier
> Sent: Saturday, July 07, 2007 12:12 AM
> To: Dmitry Stogov
> Cc: Stefan Walk; Brian Moon; internals@lists.php.net
> Subject: Re: [PHP-DEV] Simple Namespace Proposal
>
>
> On 7/6/07, Dmitry Stogov <dmitry@zend.com> wrote:
> > PHP itself (without classes) hasn't compile-time constants (and
> > variables). You can define constants only in run-time using
> define().
> > This is the reason why this proposal don't try to use constants and
> > variables in namespaces. So ithis approach is absolutely consistent.
> >
> > BTW you can "import" not only namespace but also class from
> namespace.
> >
> > <?php
> > namespace A::B;
> >
> > class Foo {
> > const C = 5;
> > }
> >
> > <?php
> > import A::B::Foo;
> > echo Foo::C;
> >
> > I would like to start with this "simple" proposal and may
> be extend it
> > with constants and variables in the future.
> >
> > Thanks. Dmitry.
> >
> > > -----Original Message-----
> > > From: Stefan Walk [mailto:stefan.walk@gmail.com]
> > > Sent: Friday, July 06, 2007 10:26 PM
> > > To: Dmitry Stogov
> > > Cc: Brian Moon; internals@lists.php.net
> > > Subject: Re: [PHP-DEV] Simple Namespace Proposal
> > >
> > >
> > > On 04/07/07, Dmitry Stogov <dmitry@zend.com> wrote:
> > > > Nor variables naither constants.
> > > > They are defined in run-time.
> > >
> > > This seems to me like a bit of drawback. Would it be
> possible to add
> > > compile-time constants, then (like const FOO = 1; outside
> a class)?
> > > Creating a class inside a namespace for constants doesn't
> seem clean
> > > to me.
> > >
> > > Regards,
> > > Stefan
> > >
> > > --
> > > 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
> >
> >
>
> One thing I'm wondering (might have missed it on the list but
> we discussed that a little bit on irc..)
>
> Do we have to have a namespace per file or could we have our
> braces ? :)
>
> namespace A::B
> {
> class BooYa
> {
> const C = 'Foo';
> }
> }
>
> --- Then..
>
> import A::B::BooYa;
> echo BooYa::C;
>
>
>
> That way we can put more than one namespace within a file or
> such... just point me if I am replying to an existing
> question or re-asking :)
>
> Thanks,
>
> --
> David Coallier,
> Founder & Software Architect,
> Agora Production (http://agoraproduction.com)
> 51.42.06.70.18
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>