On Friday 18 September 2009 11:36:08 pm Chris Trahey wrote:
> Hey all, thanks for the discussion.
>
> First, in terms of implimentation, I've gone back and forth between a
> few ways to expose it, but it struck me tonight that the most similar
> keyword in use currently is $this. Next to that I think would be static.
>
> But it seems like there is a bigger decision to make than this
> feature. Should the language itself impose coding guidlines on
> developers?

All languages impose guidelines on developers.  Grammar does that. :-)

> This reference seems notably basic in an OOP language. The Paradigm is
> based largely on two concepts: objects and the messages between them.
> For each message, the recipient is known (intrinsically) but the
> sender is not. It seems like a basic property of a method call that is
> not exposed in a semantically appropriate way.

"basic in any OOP language" is a useless statement, as "OOP language" is such 
an ill-defined concept anyway. :-)  PHP is a hybrid language.  Is Java an OOP 
language?  Is Javascript?  Is Python?  Is Ruby?  They all have extremely 
different ideas of what "OOP" means, none of which is inherently wrong.

From a PHP perspective, as Pawel notes PHP doesn't use full on message passing 
as its communication mechanism.  A function call is not a message pass.  
Having implicit knowledge about your context (ie, the caller) makes 
encapsulation, testing, and divide-and-conquer substantially more difficult if 
not impossible.

And really, you're not talking about a caller object but about accessing 
variables in scope from the next-highest step in the call stack, which may or 
may not be an object.  (Hybrid language, remember.  It could be a lambda 
function as of PHP 5.3, or global scope, or...)  If you need a variable from 
higher in the stack, that's what function parameters are for.  

-- 
Larry Garfield
la...@garfieldtech.com

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

Reply via email to