Reply to Re: PHP6 - Comments?

Your name:

Reply:


Posted by Jerry Stuckle on 08/27/05 02:13

Tony Marston wrote:
> "Oliver Grätz" <oliver.graetz@gmx.de> wrote in message
> news:430bd331$0$24149$9b4e6d93@newsread4.arcor-online.net...
> <snip>
>
>>For version 6, namespaces are becoming a topic again, since the sheer
>>number of PHP projects will surely lead to name collisions. You take
>>solutions from two projects and bang, several classes have the same
>>name.
>
>
> Namespaces are only relevant in a compiled language where it builds up a
> catalog of all the subroutine names that may be called. In a scripting
> language such as PHP each request should only need to load in the modules
> required for that request, so how many times would you want to link to TWO
> different projects in the same request? If reqest #1 links to project #1,
> and request #2 links to project #2 there are NO clashes, so no need for
> namespaces. Besides which if component libraries are delivered as classes it
> does not matter if 100 classes contain the same function name as each will
> be qualified with their class name, thus making them unique.
>
>
>>The developers seem to be disussing about how to do it without
>>losing performance and how to hide it so that you only have to use it if
>>you want to. Old-Style code will be in a global namespace.
>>
>>Multiple inheritance will - as I guess - never be a part of PHP.
>
>
> Multiple inheritance does not exist in Java, so why should it exist in PHP?
>
> If a lot of programmers can screw up with single inheritance just think of
> the damage that multiple inheritance will offer.
>

Tony,

Actually, I can see needing namespaces in PHP. You may not take two different
complete projects - but it's nothing to take classes from different projects,
especially in a larger app. Not as common in PHP, where your projects are
generally smaller. But quite possible.

Let's take a simple example - you have a program which needs to update a MySQL
database from a SQL Server database? I.E. you have your inventory on an
internal VPN running MySQL, and you need to update the MySQL database on your
web site.

You already have the necessary classes from both, from previous projects. But
what if you have two classes named "Database"? And "Category", "Product", etc.?

You could go through and rename one (or both) of the sets of classes. Or, if
PHP had namespaces, you could create namespaces for them.

As to the multiple inheritance issue. No, Java doesn't have it. I occasionally
miss it - I've used it quite successfully in C++. But you're correct - it's
misused much more than it's used correctly, and more often than not I can code
around the restriction. Still, there are times I wish Java had it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация