Hello Stanislav,
Tuesday, August 12, 2008, 1:34:49 AM, you wrote:
> Hi!
>> "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"
> Errr... as far as I know Python has no "namespace Foo;" syntax. And as I
> repeated numerous times, the syntax should be driven primarily by
> function, not by what decision some guys (even very smart guys) took
> when they designed entirely different language. The function of PHP
> namespaces makes {} make little sense, since {} implies bounded (and
> potentially nested) scope, that is repeatable and has "inside" and
> "outside".
>> Thinking as a new user...
>> How is
>> namespace foo;
>> semantically different from
>> class foo {}
>> or even
>> function foo {}
> 1. Namespace is a tag on the entities defined inside this file, function
> is not. Class can be viewed as such, kind of, but it'd be very limiting
> view (class is more than just tag on set of function names).
> 2. Class and function exist as stand-alone entity, namespace does not.
> 3. There can be context outside class/function in this file, but not
> outside namespace.
>> 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?
> Well, it should act differently for the same reason class and function
> act differently - because they are different things. ITYM "why the
> should _look_ differently?". As I said, that is because for them to look
> the same would be to imply things about namespaces that are not true.
>> 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 ;)
> I can help with that. Here's world's shortest course on PHP namespaces:
> 1. To define namespace for the file, write "namespace Foo::Bar;" at the
> beginning of the file.
> 2. That's it, enjoy. ;)
3. You want another namespace, just write namespace again.
4. You got lost after the 10th namespace? Welcome to if-else nesting
ambiguty all over again.
Some coding style guides force curly braces for if-else for a reason.
Best regards,
Marcus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php