ENIGMA Forums

Contributing to ENIGMA => Proposals => Topic started by: Josh @ Dreamland on February 22, 2013, 12:17:22 pm

Title: Overloads in other languages
Post by: Josh @ Dreamland on February 22, 2013, 12:17:22 pm
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.