Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-20-2007, 10:53 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
super functions?

Considering that functions are now variables... Wouldn't it be easy to implement this?

PHP Code:
function echo( text )
{
  
super::echo( format("[%s]: %s"this.nametext ) );

Reply With Quote
  #2  
Old 05-20-2007, 04:27 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
What exactly would these super functions do?
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #3  
Old 05-20-2007, 04:28 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by killerogue View Post
What exactly would these super functions do?
I'm not sure, but probably overriding an existing function with that name.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 05-20-2007, 08:20 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Use the old function from within the new function I guess.
Bad idea. Don't override. It makes for ugly development later on, when those who inherit your code try and use the original function without thinking "Oh yeah, grampa redefined "echo", I need to use "super::echo". Just don't, name yours "echo2" and have done. Mass replacement's not hard.
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #5  
Old 05-21-2007, 12:45 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Next he'll ask for overloaded functions .
Reply With Quote
  #6  
Old 05-21-2007, 01:11 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
What would be nice is if we could access the code that each built-in function uses (or does it use built-in code, not gs2?) and ever nicer to be able to modify.
__________________
Reply With Quote
  #7  
Old 05-21-2007, 01:52 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
well logically, if it was in a class called super and you joined it.

you could do:
super::echo(stuff);

I think.
__________________
- Zidane / Zidaya
Reply With Quote
  #8  
Old 05-21-2007, 02:31 AM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Quote:
Originally Posted by Twinny View Post
Next he'll ask for overloaded functions .
Now that would be nice.
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #9  
Old 05-21-2007, 02:45 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by Deadly_Killer View Post
well logically, if it was in a class called super and you joined it.

you could do:
super::echo(stuff);

I think.
PHP Code:
function onCreated()
  {
  
this._oldEcho this.echo;
  }

function echo( 
text )
  {
  return 
this._oldEchoformat("[%s]: %s"this.nametext ) ) );
  } 
That's be what I'd have to do... Which is a pain...
Reply With Quote
  #10  
Old 05-21-2007, 03:57 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
I have no idea what these function objects are and am yet to play with them until I get a decent explanation on what I could possibly do with them.
__________________
- Zidane / Zidaya
Reply With Quote
  #11  
Old 05-21-2007, 11:25 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
You cant overload functions since everything is TGraalVar in the basic sense. You could have an if statement in a function to check the type of the parameter, but doing that is bad (I've tried it) since variables aren't always what they're supposed to be. Better to sick with separate functions. Though I would like it if the params array was present for all functions and not just actions.

What I would like is Custom Object Types And the ability to add global functions.

I have yet to see an actual demonstration of function objects though I would like it very much.
__________________
Reply With Quote
Reply


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 10:04 PM.


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