Re: php5 class initialization
| From: | Stanislav Malyshev | Date: | Wed, 24 Mar 2004 09:33:23 +0000 |
| Subject: | Re: php5 class initialization | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8742@lists.php.net to get a copy of this message | ||
RL>> There are a number of changes between PHP4 and PHP5 that aren't strictly
RL>> syntactical but rather behavioural so while the code itself will pass the
RL>> php4 syntax check, it would not run as intended and thus be PHP5 only.
Hm. Do you have some example of such code? Except for object cloning
issues which are application-wide and constructors won't help you there -
is there some class code that should be constructed differently in PHP5
but behave exactly the same in all other aspects?
RL>> It could also be that this isn't in the same class. You might simply be
RL>> extending a legacy PHP4 class with code specific to PHP5 and you don't
But you _are_ changing it - actually, you are replacing the constructor.
That isn't different from renaming the old constructor and calling it as a
function - except that this way doesn't require any obscure "magic"
involved and is immediately obvious for anyone looking at the code.
RL>> want to change the legacy class. I suppose I could write up a realworld
RL>> example of this, but I don't think it is that obtuse.
By "real world" I don't mean "you write up", I mean "someone really
needs
it". You are defining language practice now. I think it's a bad practice to
have "magical" constructors to behave differently according to presence of
some other code.
--
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.109