Pages: 1
  Print  
Author Topic: Overloads in other languages  (Read 4493 times)
Offline (Male) Josh @ Dreamland
Posted on: February 22, 2013, 12:17:22 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
This is mostly for TGMG/whoever furthers EGMJS.

Code: (JavaScript) [Select]
function my_overloaded_function(x,y) {
  // code
}
my_overloaded_function.argc_min = 2;
my_overloaded_function.argc_max = 2;
my_overloaded_function.overloads = [];
my_overloaded_function.overloads[0] = function(x,y,z) {
  // code
};
my_overloaded_function.overloads[0].argc_min = 3;
my_overloaded_function.overloads[0].argc_max = 3;

That will be able to translate directly to JDI's storage classes. Essentially, some JS interpreter will use reflection to read through and copy those values from each function into the appropriate storage classes in JDI. Not a huge deal.

This is an optional feature of the engine, but the new EDL specification does support user-overloaded functions.

The pretty printer must select the correct overload when outputting code. JDI will provide helper functions to do this.
« Last Edit: February 22, 2013, 12:19:48 pm by Josh @ Dreamland » Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: 1
  Print