Not so chicken and egg if, through reflection, a ReflectionClass object could
inform all the instances of that class in a simple array or with an iterator.
May be there's another even better place where to implement such a
functionality, i'm just pointing reflection because i think it's natural t
2005/5/10, Sebastian Bergmann <[EMAIL PROTECTED]>:
> Lukas Smith wrote:
> > http://bugs.php.net/bug.php?id=30235
>
> I agree with Marcus: self is bound at runtime, so the behaviour is
> correct. If you do not like this late binding just do not use self but
> the name of the class.
I don't agre
Chicken and egg; you can't keep the object alive without a reference.
There is no way to achieve what you want, and we're not going to
change the behaviour of the new operator, nor are we going to build
some kind of singleton factory thingy into the core language; you have
the tools to do it "the r
Ondrej IvaniÄ wrote:
class SingletonFactory {
private $instances;
__construct() {
$this->instances = array();
}
function getInstance($name) {
if(is_a($this->instances[$name], $name) === false) {
$this->instances
How do i obtain the object again having just the key when i want to return it
in another call, if i don't have a reference somewhere?
The point would be: object asked id #1, it is not already loaded, load it and
return it, end. Then, in another call: object asked id #1, it is already
loaded, ret
Leonardo Pedretti wrote:
Yes, the question was pointed in another way, the destructors are not called
until the last reference to an object has been removed, but if you store a
reference in an array so you lately return a reference to the already loaded
instance instead of creating an aliasing o
Yes, the question was pointed in another way, the destructors are not called
until the last reference to an object has been removed, but if you store a
reference in an array so you lately return a reference to the already loaded
instance instead of creating an aliasing of that instance, then you
Lukas Smith wrote:
> So please explain to me how you would write a singleton static method
> for a base class from which you can inherite. Suddenly the idea with
> using the class name becomes less useful.
IMHO, you need singleton factory :)
Inheritance is very strong relationship between classes
Leonardo Pedretti wrote:
It would not be such a problem to write something that does the same task
through a static or global function, but unfortunately it is impossible, due
to the following: you can build a cache in an array, then in a __new()
function you could check if the requested object
It would not be such a problem to write something that does the same task
through a static or global function, but unfortunately it is impossible, due
to the following: you can build a cache in an array, then in a __new()
function you could check if the requested object is already loaded and ret
Lukas Smith wrote:
Sebastian Bergmann wrote:
Lukas Smith wrote:
http://bugs.php.net/bug.php?id=30235
I agree with Marcus: self is bound at runtime, so the behaviour is
correct. If you do not like this late binding just do not use self but
the name of the class.
So please explain to me how you
Sebastian Bergmann wrote:
Lukas Smith wrote:
http://bugs.php.net/bug.php?id=30235
I agree with Marcus: self is bound at runtime, so the behaviour is
correct. If you do not like this late binding just do not use self but
the name of the class.
So please explain to me how you would write a single
Jason Sweat wrote:
When the class is named SomeLongNameBecauseWedontHaveNamespaces and I
define a SELF_EXPLAINING_CONSTANT_NUMBER_ONE I've to write
SomeLongNameBecauseWedontHaveNamespaces::SELF_EXPLAINING_CONSTANT_NUMBER_ONE
to access it from within the class itself.
Is there a way to reference con
On 5/10/05, Markus Fischer <[EMAIL PROTECTED]> wrote:
> When the class is named SomeLongNameBecauseWedontHaveNamespaces and I
> define a SELF_EXPLAINING_CONSTANT_NUMBER_ONE I've to write
> SomeLongNameBecauseWedontHaveNamespaces::SELF_EXPLAINING_CONSTANT_NUMBER_ONE
> to access it from within the cl
Hello Markus,
Tuesday, May 10, 2005, 8:31:05 AM, you wrote:
> Sebastian Bergmann wrote:
>> Lukas Smith wrote:
>>
>>>http://bugs.php.net/bug.php?id=30235
>>
>>
>> I agree with Marcus: self is bound at runtime, so the behaviour is
>> correct. If you do not like this late binding just do not us
Marcus Boerger wrote:
I agree with Marcus: self is bound at runtime, so the behaviour is
correct. If you do not like this late binding just do not use self but
the name of the class.
Sorry to jump in the middle, but I've similiar question to constants
defined in classes.
When the class is named
On Tuesday 10 May 2005 00:48, john wrote:
> I have been developing a site which stores an image files binary data
> inside a session variable. Initially, I was developing this site on the
> following environment:
>
> Apache-2.0.52/PHP5.0.3/Windows XP
>
> Things worked very well, as I expected them
Sebastian Bergmann wrote:
Lukas Smith wrote:
http://bugs.php.net/bug.php?id=30235
I agree with Marcus: self is bound at runtime, so the behaviour is
correct. If you do not like this late binding just do not use self but
the name of the class.
Sorry to jump in the middle, but I've similiar quest
18 matches
Mail list logo