ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
RE: [PHP-DEV] Simple Namespace Proposal
by Giedrius D other posts by this author
Jul 15 2007 6:24AM messages near this date
Re: [PHP-DEV] Simple Namespace Proposal | Re: [PHP-DEV] Simple Namespace Proposal
Hi,

I read whole discussion and I'd like to share my opinion.

>  > Similarly, allowing multiple namespaces per file does not limit the
>  > developer in any way. Not allowing them does. I always thought a
>  > language should be designed to empower it's developers, not get in
>  > their way.
> 
>  My opinion is that sometimes language *should* "get in the way" - if the
>  developer is trying to do a wrong thing. Doing things right should be
>  easy, doing things wrong should be hard. I agree that this means we
>  should choose some definitions for right and wrong, and not everybody
>  would necessarily agree, but I think the benefit of the clearer program
>  structure exceeds the disadvantage of not being able to do some tricks.
>  That's one of the reasons why PHP doesn't have some things that other
>  languages might have, such as nested classes, multiple inheritance or
>  closures.

I agree with Andrew Minerd. Language shouldn't get in developers way.
If its too
hard to implement then let it be. Most developers can live with that I
guess. However if
the only reason for this is so called "clearer program structure" then
I don't think
this limit is reasonable. There's no such thing as absolutely "wrong
thing to do".
The thing that is "wrong thing to do" in one situation may be a "good
thing to do" in
other. One size *does not* fit all.


The other thing that bothers me is namespaces nesting. It was said
that namespaces
nesting is not supported. Then I'm missing a point in having namespace
named "A::B".
Lets say I have three files:

a.php:
<?php
namespace A;

function foo()
{
}
?> 

b.php:
<?php
namespace A::B;

function bar()
{
    //foo();
}
?> 

index.php:
<?php
require 'a.php';
require 'b.php';

import A;
foo(); // should call A::foo(), right?
B::bar(); // will this call A::B::bar()?
?> 

If this works then we have a nested namespace here. The only thing
that's missing is
[commented] foo() call in A::B::bar() to be correctly resolve to
A::foo() as now it would
resolve to built-in function foo() if I understand it correctly.

Now if this does not work then whats the point in having namespace
"A::B" instead of "A_B"? IMHO this brings more confusion then
clearness.


Regards,
Giedrius

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Dmitry Stogov
Derick Rethans
Dmitry Stogov
Dmitry Stogov
dz
David Coallier
Guilherme Blanco
Stanislav Malyshev
Dmitry Stogov
Markus Fischer
Stanislav Malyshev
Stanislav Malyshev
Stanislav Malyshev
Giedrius D
Stanislav Malyshev
Giedrius D
Stanislav Malyshev
Giedrius D
Andrew Minerd
Stanislav Malyshev
David Coallier
Chris#
Dmitry Stogov
nicobn
Chris#
Chrish
Dmitry Stogov
Andrei Zmievski
Stefan Priebsch
Stanislav Malyshev
Richard Lynch
Dmitry Stogov
Stanislav Malyshev
Andrei Zmievski
Stefan Priebsch
Stanislav Malyshev
Stefan Priebsch
Richard Lynch
Stefan Priebsch
Jani Taskinen
David Coallier
Robert Cummings
Richard Lynch
Stanislav Malyshev
Lukas Kahwe Smith
Derick Rethans
Stefan Priebsch
Stanislav Malyshev
Derick Rethans
Stanislav Malyshev
Stanislav Malyshev
Stanislav Malyshev
Dmitry Stogov
Stefan Priebsch
Dmitry Stogov
Jeremy Privett
Stanislav Malyshev
nicobn
Tony Bibbs
Stanislav Malyshev
Stefan Priebsch
David Coallier
Rich Buggy
Stanislav Malyshev
Stefan Priebsch
David Coallier
Dmitry Stogov
Andrei Zmievski
Hans Lellelid
dz
Guilherme Blanco
Alexey Zakhlestin
Stanislav Malyshev
Jeremy Privett
Dmitry Stogov
Arpad Ray
Dmitry Stogov
Stanislav Malyshev
Markus Fischer
David Coallier
Stanislav Malyshev
Brian Moon
Dmitry Stogov
Stanislav Malyshev
Brian Moon
Stanislav Malyshev
Dmitry Stogov
Stefan Walk
Dmitry Stogov
David Coallier
Dmitry Stogov
Stefan Priebsch
Stanislav Malyshev
Stefan Priebsch
Larry Garfield
Dmitry Stogov
Larry Garfield
Dmitry Stogov
Derick Rethans
Dmitry Stogov
nicobn
Sebastian Bergmann
Dmitry Stogov
nicobn
Rasmus Lerdorf
Lucas Nealan
Stefan Priebsch
Rasmus Lerdorf
Stefan Priebsch
Sebastian Bergmann
Stefan Priebsch
Dmitry Stogov
Sebastian Bergmann
Stanislav Malyshev
davidc
Stanislav Malyshev

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved