WhiteDragon |
08-09-2008 02:14 AM |
Class joining bug/undocumented feature
This is the code I am executing:
-whitedragon_system
PHP Code:
new TStaticVar("Movement").join("whitedragon_system_movement");
new Movement("NormalMovement").join("whitedragon_system_movement_normal");
this.movement = new NormalMovement().construct();
whitedragon_system_movement
PHP Code:
public function construct() {
echo("----------");
echo(this.joinedclasses);
echo(this.getfunctions());
for(f : this.getfunctions())
echo(f SPC f.scope);
echo("----------");
return this;
}
whitedragon_system_movement_normal
PHP Code:
public function construct() {
echo("movement_normal");
return this;
}
The code that you see in whitedragon_system_movement is some debugging code to see exactly what functions exist and what is getting over written.
I get the following output:
PHP Code:
----------
whitedragon_system_movement,"",whitedragon_system_movement_normal
loadstring,geteditvarnames,insertarray,subarray2,addnamedstring,savexmltostring,ignoreevents,loadvarsfromarray,loadini,getdynamicvarnames,savevars,sortdescending,loadvars,loadxml,savelines,cancelevents,getfunctions,copyfrom,getstaticvarnames,sortbyvalue,getvarnames,hasfunction,clearemptyvars,timershow,addarray,leave,loadxmlfromstring,scheduleevent,loadlines,objecttype,settimer,savestring,ignoreevent,loadfolder,addarraymember,destroy,savevarstoarray,join,catchevent,sortascending,getarraymember,trigger,isinclass,savexml,clearvars,construct,construct
loadstring public
geteditvarnames public
insertarray public
subarray2 public
addnamedstring public
savexmltostring public
ignoreevents public
loadvarsfromarray public
loadini public
getdynamicvarnames public
savevars public
sortdescending public
loadvars public
loadxml public
savelines public
cancelevents public
getfunctions public
copyfrom public
getstaticvarnames public
sortbyvalue public
getvarnames public
hasfunction public
clearemptyvars public
timershow public
addarray public
leave public
loadxmlfromstring public
scheduleevent public
loadlines public
objecttype public
settimer public
savestring public
ignoreevent public
loadfolder public
addarraymember public
destroy public
savevarstoarray public
join public
catchevent public
sortascending public
getarraymember public
trigger public
isinclass public
savexml public
clearvars public
construct public
That's handful, so I'll sum it up for you: - echo(this.getfunctions()) echos "construct" twice.
- The loop echos "construct" once.
- It doesn't finish the block of code (there are no ending dashes echoed).
This behavior is getting so weird, I had no idea what was going on.
Even speculation would be helpful.
Thank you. :D
|