|
Posted by Oli Filth on 05/26/06 21:41
Chung Leong said the following on 26/05/2006 18:48:
> Oli Filth wrote:
>> If I understand your allusion correctly, in some ways, I'd say it's the
>> other way round. PHP lets you do a lot of unfunky things because the
>> developers didn't like the idea of being seen to enforce "funkiness" on
>> those uninitiated in the ways of funkiness, even though disciplined
>> funkiness would have been for their own good! IMO, the
>> static/non-static confusion and ability to add object variables
>> willy-nilly are two perfect examples of this in PHP.
>
> I guess "funk" is not a very precise term :-)
Yes, it looks like I completely misinterpreted what you meant!
> What I meant was the ability to call a non-static function statically
> is highly unorthodox, but it requires extra effort to stop it. The
> problem is here that the class::method() syntax is overloaded: it's
> used for calling static method as well as for a non-static method to
> call an overridden non-static methods in the ancestor classes. To
> determine if a invocation is "legal" requires checking the context in
> which it was made, which has to happen at runtime, with every call.
Hmm, I'd never thought about it like that. You're right of course.
However, this logic applies to any use of a function/member/method at
any point. Any time a symbol is used, PHP presumably has to interrogate
some kind of symbol table to find whether that symbol exists in the
current scope, and is legal.
<...SNIP MY POLEMIC...>
>
> If you're saying that PHP isn't a good OO language, I wouldn't
> disagree. In my opinion a lot of the additions in PHP 5 are just me-too
> fluff. PHP can never be a strict language because of its dynamic
> nature. When you can have constructs like this:
>
> if($best_case_scenario) {
>
> class Iraq extends Democracy {
> public $army;
> }
>
> } else {
>
> class Iraq extends Quagmire {
> private $army;
> }
>
> }
Political connotations aside ( :) ), it's this kind of nonsense that
makes me never want to use PHP again, at times! I know that some people
see this as a useful "feature", but coming from a compiled-language
background, I see this only as a development nightmare, and a massive
limitation on language strictness, as you've already commented on...
(Just in case; yes, I know that PHP isn't the only language that does this.)
> The kinds of checks you can do at compile time are very limited. Doing
> validation at runtime on the other hand is a drag on performance, which
> is already low because the language is interpreted.
>
--
Oli
Navigation:
[Reply to this message]
|