| 06-16-2008, 08:57 PM | #1 |
Would it be possible to implement function overloading into vJass? |
| 06-17-2008, 12:42 PM | #2 |
Do you mean like this? JASS:interface Data method doSomething takes nothing returns nothing defaults nothing endinterface struct DataEx extends Data unit u method doSomething takes nothing returns nothing call BJDebugMsg(GetUnitName(u)) endmethod endstruct function Actions takes nothing returns nothing local Data d=DataEx.create() call d.doSomething() endfunction |
| 06-17-2008, 12:56 PM | #3 |
It's certainly possible using name mangling like in c++ for example. Do we want overloading? PS: No Themerion, overloading means two (or more) functions with the same name but different parameters. Depending on the type and number of passed in arguments the compiler can decide which is to be used. |
| 06-17-2008, 01:02 PM | #4 |
Hopefully not before there is more powerful operator overloading and proper virtual methods. |
| 06-17-2008, 01:47 PM | #5 |
Overloading is aweasome for systems, my AMHS would benefit from it. All we have now is operator overloading |
| 06-17-2008, 02:47 PM | #6 |
Planned stuff: - "extends struct" : A super keyword that allows you to use the paren'ts interface-replacing methods. - "interfaces,extends stuff": parent's create will have the correct type if called from a child (so you can call the child's interface methods from there) - function 'overloading' will not be implemented, but I think I will allow default arguments. |
