Re: RE:Class::? - accessing data, no success...
| From: | waldschrott | Date: | Tue, 04 Jul 2000 09:24:58 +0000 |
| Subject: | Re: RE:Class::? - accessing data, no success... | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-23430@lists.php.net to get a copy of this message | ||
SM> First of all, C++ is far from being best OO language. Being derived from C
SM> (which is nothing but a macroassembler, from the language standpoint) it
SM> is suffering from many inconsistencies. Doing something just because C++
SM> does it is not a good reason.
Good point, but me and some others who asked fot that functionality have seen a possible need in PHP without regarding what C++ does (at least me :) ), just for the reason that it can be handy to get information about classes datamember without the need to instanciate it.
SM> Please explain - what exactly do you want to get when you require data
SM> member from a class? A new variable that is "magically" created? And where
Huh, that much thinking so early...
I thought of a storing it in a kind of non-visible hash table.
(BTW, currently it does not seem to be posssible using :: with variables at all like you did $class::var (you could use eval(), sure)).
I exactly want to get the assigned variable, like it is declared.
SM> will it be stored? What happens if you do $class::var = 1? All objects get
SM> "var" property magically set to 1 (like it is in C++)? Or just a new
SM> classes?
Magically creation seems to be popular in PHP, but that kind of *magically creation* is not popular in PHP, I think. Perhaps it makes sense, but for now I do not see a need for a mighty *lookup all instances and assign $this->var=1 there* I even do not know if assignment should be possible.
The most important thing is retrieving the data, if one could change the initial class declaration with $class::var=$x; - nice, but I think Zeev&Andi won´t like that ;) - and if you decide implementing this post-declaration-modification, you´ll have to add this functionality for methods too (perhaps nice too).
As said, retrieving the data is the hard point...
--
o----------0-¬---------O-·---¬----o---®-----o o O ° .
| http://www.kiffen.de | pRoteçt y0ur bRaín |0 O ° ¤ °
·
0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ °
o © ° . ·
| psychedelic experience | gott@kiffen.de | O ° o °
o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·