Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Bug Report
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-06-2008, 10:37 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Object method declaration in joined classes.

I think this is the correct forum this time.
Following is a description of what I assume is a bug. I managed to rule out any human factor.

My stuff behaved like it was magic for a while until I succeeded in isolating the problem.

It seems like functions in a joined class isn't fully aware of what is happening in the real script. The following scripts creates two TStaticVars and assigns anonymous functions to them, one in a joined class-function and one native. The functions both end up with the same identifier, function_1, and whichever function was defined first is overwritten.

A DBNPC:
PHP Code:
function onCreated()
{
  
join("some_class");
  
temp.foo createNewTStaticVarFromAnotherClass();
  
  
temp.foo.forkFunctionCollision();
  echo(
temp.foo.forkFunctionCollision);
  
  
temp.bar = new TStaticVar();
  
temp.bar.secondFunctionCollision = function() {
    echo(
"secondFunctionCollision");
  };
  
  
temp.bar.secondFunctionCollision();
  echo(
temp.bar.secondFunctionCollision);

some_class:
PHP Code:
function createNewTStaticVarFromAnotherClass()
{
  
temp.crux = new TStaticVar();
  
temp.crux.forkFunctionCollision = function() {
    echo(
"forkFunctionCollision");
  };
  
  return 
temp.crux;

Output:
Quote:
secondFunctionCollision
function_1
secondFunctionCollision
function_1
I assume this is supposed to output:
Quote:
forkFunctionCollision
function_1
secondFunctionCollision
function_2

Oh, hello mister inappropriate censorship; I think I'll rename firstFunctionCollision() to something else.
That's word censor evasion 101 by the way.

Last edited by DrakilorP2P; 07-07-2008 at 04:24 PM.. Reason: Improved sentence structure.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:21 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.