General question: packaging in PHP
Hello,
i've a general question concerning PHP's architecture.
Why isn't there a native packaging concept in PHP?
I think php became much more powerfull with the extended OOP features
introduced in PHP5 - without a packaging concept you couldn't use these
features "in big business" (in terms of sharing classes/libraries). I know
the discussion of OOP features vs. PHPs scripting capabilities, but IMHO
doing the half way of OOP isn't right...
Are there any thoughts about that in future releases?
What do other developers think about this issue?
How do organize multiple used classnames?
Thanks for your answers..
with best regards,
vivian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: General question: packaging in PHP
>From: "Vivian Steller" <vivian.steller [at] informatik.uni-ulm.de>
> i've a general question concerning PHP's architecture.
>
> Why isn't there a native packaging concept in PHP?
This was also suggested on comp.lang.php, recently (the "nested class"
thread), called "namespaces", but there wasn't a lot of enthusiasm for it.
Apparently, it was even implemented at one point, but then subsequently
dropped. I've found it difficult to find the relevant discussion in the
archive (possible the internals-list or Zend's engin2-list), could anyone
provide a link?
> I think php became much more powerfull with the extended OOP features
> introduced in PHP5 - without a packaging concept you couldn't use these
> features "in big business" (in terms of sharing classes/libraries). I know
> the discussion of OOP features vs. PHPs scripting capabilities, but IMHO
> doing the half way of OOP isn't right...
I guess package/namespace doesn't have a lot to do with OO (except that they
both allow grouping of functionality, and avoiding name collision, but
that's not the only benefit of OO), but as there hasn't been any enthusiasm
for overloading, either (not even for user-defined types, where you _can_
use "type hints" in function signatures), and it's common in OO languages, I
guess you have a point. Interestingly, I found that Perl has the possibility
of function overloading (also a language that's dynamically typed)
(http://www.math.tu-berlin.de/polymake/perl/overload.html) It also has -
like Python - operator overloading. But is there any enthusiasm for that in
the PHP community, either? Nah...
> Are there any thoughts about that in future releases?
> What do other developers think about this issue?
> How do organize multiple used classnames?
The common answer is: "Use a prefix"...
Regards,
Terje
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: General question: packaging in PHP
<veröffentlicht & per Mail versendet>
Thanks for your answer!
Terje Slettebø wrote:
>>From: "Vivian Steller" <vivian.steller [at] informatik.uni-ulm.de>
>
>> i've a general question concerning PHP's architecture.
>>
>> Why isn't there a native packaging concept in PHP?
>
> This was also suggested on comp.lang.php, recently (the "nested class"
> thread), called "namespaces", but there wasn't a lot of enthusiasm for it.
> Apparently, it was even implemented at one point, but then subsequently
> dropped. I've found it difficult to find the relevant discussion in the
> archive (possible the internals-list or Zend's engin2-list), could anyone
> provide a link?
>
>> I think php became much more powerfull with the extended OOP features
>> introduced in PHP5 - without a packaging concept you couldn't use these
>> features "in big business" (in terms of sharing classes/libraries). I
>> know the discussion of OOP features vs. PHPs scripting capabilities, but
>> IMHO doing the half way of OOP isn't right...
>
> I guess package/namespace doesn't have a lot to do with OO (except that
> they both allow grouping of functionality, and avoiding name collision,
> but that's not the only benefit of OO), but as there hasn't been any
> enthusiasm for overloading, either (not even for user-defined types, where
> you _can_ use "type hints" in function signatures), and it's common in OO
> languages, I guess you have a point.
Thanks for metioning this issue! This is another point where I think OO is
done the half way in PHP:
Why do we need some implicit type check, like
public method(Type $type)
if we then loose the optional parameter advantage?
Either some polymorphism mechanism should be implemented, or something like
public method(Type $type = new MyType())
should be able being passed through the interpreter..
also the primitive datatypes should be (exceptionally) used here:
public method(string $argument)
Otherwise (IMHO) the typecheck mechanism is useless.
> Interestingly, I found that Perl has
> the possibility of function overloading (also a language that's
> dynamically typed)
> (http://www.math.tu-berlin.de/polymake/perl/overload.html) It also has -
> like Python - operator overloading. But is there any enthusiasm for that
> in the PHP community, either? Nah...
regrettably... :(
>
>> Are there any thoughts about that in future releases?
>> What do other developers think about this issue?
>> How do organize multiple used classnames?
>
> The common answer is: "Use a prefix"...
but i really dislike using cryptic and long prefixes to ensure uniqueness...
dots in the classname (ok, doing it like java) would be so nice, gr**
>
> Regards,
>
> Terje
vivian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: General question: packaging in PHP
Vivian Steller wrote:
....
>
> Thanks for metioning this issue! This is another point where I think OO is
> done the half way in PHP:
>
> Why do we need some implicit type check, like
> public method(Type $type)
> if we then loose the optional parameter advantage?
I don't know *the* answer. So far as I can tell this is one of those
"that's just the way it is" type of issue.
>
> Either some polymorphism mechanism should be implemented, or something like
> public method(Type $type = new MyType())
> should be able being passed through the interpreter..
>
> also the primitive datatypes should be (exceptionally) used here:
> public method(string $argument)
You're not the first to ask for this. In fact, I think this might have
even made it into the TODO list... but don't count on it any time soon.
>
> Otherwise (IMHO) the typecheck mechanism is useless.
Not useless, but yes it is handicapped. You have to expect an object in
order to tell the interpreter which type of object to expect.
>
>
>>Interestingly, I found that Perl has
>>the possibility of function overloading (also a language that's
>>dynamically typed)
>>(http://www.math.tu-berlin.de/polymake/perl/overload.html) It also has -
>>like Python - operator overloading. But is there any enthusiasm for that
>>in the PHP community, either? Nah...
>
> regrettably... :(
>
>
>>>Are there any thoughts about that in future releases?
Possibly an implementation for primitive type checking in the future...
but don't hold out on it.
>>>What do other developers think about this issue?
Not a big deal. I generally *like* having the flexibility. And if I
really want / need to check I use the is_* functions.
>>>How do organize multiple used classnames?
>>
>>The common answer is: "Use a prefix"...
>
> but i really dislike using cryptic and long prefixes to ensure uniqueness...
> dots in the classname (ok, doing it like java) would be so nice, gr**
No new advice here. Personally I find classnames like XML_XSLT_Wrapper
to be short enough, yet they provide enough of a "namespace" for me to
not worry about collisions for my Wrapper class and are descriptive when
I'm just viewing the source code.
>
>
>>Regards,
>>
>>Terje
>
>
> vivian
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform= Find+search+plugins
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: General question: packaging in PHP
>From: "Vivian Steller" <vivian.steller [at] informatik.uni-ulm.de>
> >> Are there any thoughts about that in future releases?
> >> What do other developers think about this issue?
> >> How do organize multiple used classnames?
> >
> > The common answer is: "Use a prefix"...
> but i really dislike using cryptic and long prefixes to ensure
uniqueness...
You're not alone...
Regards,
Terje
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php