Stanislav Malyshev wrote:
> When we adopt some syntax, especially syntax matching some other
> language, we do not just introduce an otherwise meaningless sequence of
> symbols to be learned by users. We introduce concepts, and we create
> associative links with other languages. So, if we introduced the syntax
> for namespaces that is used by C++ - i.e. braces, we would imply that it
> has all the properties that C++ one has and that we encourage the usage
> patterns that C++ users adopt. Namely, that namespaces can be nested,
> that they are hierarchical, that namespaces can be used in any place in
> the file, just for one function/class or even variable without any
> influence on the surroundings, that using multiple namespaces in the
> same file, along with global space, is completely OK.

Except that C++ is not the only language that uses this syntax, nor is
it the only language with "baggage" associated with syntax - to say that
"I don't want braces because people would think it acts like C++" is as
silly as saying "I don't want the current namespace Foo; syntax because
people will think it acts like python"

The bottom line is this is new for PHP, and although there will be
confusion when it's first introduced (goodness, PHP5 had plenty of
teaching over __construct) eventually with good documentation people
will learn what to expect from the PHP version - and that it is not like
 Java/C++/C#/Python/whatever

<snip>

> With all that, there's not one thing that syntax with {} enables us to
> do and that is not possible to do right now (and that we want to do :).
> Only reason presented for this change is the misguided notion of
> "consistency", grounded in the belief that semantically different
> constructs must look the same, because that way they will be... well,
> "consistent".

Thinking as a new user...
How is
namespace foo;
semantically different from
class foo {}
or even
function foo {}

I'm defining something yes?  With stuff basically "inside it".  Yes an
oversimplification, but the strength of PHP has always been simple.  So
why should it act differently?  Why does it need different syntax to
define something?

> While similarity in function in many cases should produce
> similarity in looks, I believe there's substantial semantic difference
> between namespaces and classes or functions, enough to make them use
> different syntax, especially when it better fits the function namespaces
> are to serve in PHP.

And here is the difference - I don't believe there's substantial
semantic difference between namespaces or classes or functions, enough
to require teaching a new syntax.

But at the end of the day this is all personal preference.  Just
remember the poor people who have to teach this to the new users ;)

Thanks,
Elizabeth Smith

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to