Poll: Function overriding in Verge
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
gannon

How do you think verge should handle duplicate functions?

a. Allow no duplicate functions. No map function can have the same name as a system function.

b. Map functions override system functions. ie. If you had a function in a map called move_up and a one in your system.vc called the same thing the map one would be called first.

c. By where the caller is. So where ever the caller is is where it looks first. If the caller is a system function it looks in system first if the caller is a map function it looks there first.

Posted on 2005-07-26 22:52:03

mcgrue

Personally I'm for no overlapping of namespace just so there's no question as to where a problem is coming from when a problem happens.

Alternately, some sort of stacktracing on error reporting could alleviate my worries, but I don't know how feasable that is.

Posted on 2005-07-26 22:59:01

Omni

It sounds...kinda neat, but I'm not sure how useful it would be. I would much more prefer being about to override my own functions with something like

DisplayImage(int x, int y, int dest, int src)
DisplayImage(int x, int y, int src)
DisplayImage(int src, int dest)

and have each function, same name, different code. Not sure what that's called...and anyway, I can live without this.

Maybe some people could use it...I think I might pass.

Posted on 2005-07-26 23:44:14

Overkill

Omni, what you want could probably be done through:

void DisplayImage(int x, int y, int src, dest = screen)
{
// ...
}

Which would allow for:

DisplayImage(int x, int y, int src[, dest])

...If that were implemented.


I'm sort of against overlapping functions with the same names. I don't see many instances where you need it really. And it's annoying when unintentionally overlapping something.

Posted on 2005-07-27 08:40:46

Kildorf

If we have duplicate functions, I'm for (c). This way there's less chance of accidentally breaking your system code with some poorly named map-code functions.


Also, as an aside, Omni: That's called function 'overloading'. And yeah, it's pretty cool, but not really necessary, I don't think. It just makes things seem a little more magical, for the sake of a little bit less typing on the part of the programmer. If you want magical, why are you using Verge? ;)


... Which I think actually brings us back to the original topic. Maybe it would be best to just disallow duplicate functions at all.

Posted on 2005-07-27 10:21:46


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.