On 5/9/06, D. Dante Lorenso <[EMAIL PROTECTED]> wrote:
As an OOP programmer, I would expect the scope search to be as follows:

   1. LOCAL: current method
   2. THIS: current instance ($this)
   3. SELF: current class & parent classes, in order of inheritance
   4. GLOBAL: globals


Ok, so this is interesting Dante, you have me thinking... Perhaps this
is all a result of PHP being a procedural language first, and an OOP
language second?  Indeed, even if our PHP applications are fully
abstracted into objects, they still begin their lives in a procedural
way...

[thinking_aloud]
I have little experience with pure OOP, short of a quick dive into
Java, but I do recall that any J2EE web application that runs does so
as an instance of a class (which is a child of some base "listener"
class that handles web requests).  So your initial "scope" sort of is
at a "local object" level.  So then it would make perfect sense as a
programmer to want the ability to call an object constant or static
property without having to say "hey, look for xxxx in the same place
that I am right now". Because there's nowhere else you'd be, anyway.

But with PHP, every script starts out procedurally, and hence at the
"global" level.  Then we instantiate a class, step into that object,
and do our thing.  But still, we _started_ outside, and our scope
"ladder" does too.
[/thinking_aloud]

Yes? No? Maybe so?

-John W

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to