Without functions, JS code can become quiet complicated + duplicated + hard to read (especially @gfx) + bigger JS + etc..
One pragmatic/reasonable solution (if we think to ASM compilation that occurs behind the scene) would perharps be a new "goto" instruction (?)
Example: a "function" in JS that returns (prm1+prm2)
Code:
[...]
@block
// "FUNCTION" MUL
@mul
return = prm1 * prm2;
goto caller;
// "FUNCTION" ADD
@add
return = prm1 + prm2;
goto caller;
[...]
// CALL TO THE ADD "FUNCTION"
prm1 = 78;
prm2 = 2.33;
caller = "stuff";
goto "add";
@stuff
myArray[i] = return;
[...]
This is a raw "function" example, just to describe the idea. There're many other cases where a goto instruction could be useful.
I'm not asking for -this- implementation (string type doesn't exist in JS so, for ex., @custom_parts could be numerical values: @12 / goto 12)
OT: being a dev and entering GOTO fr 20 years after the glorious Commodore 64 is just a shame. Never thought I'd have to do that one day!
=> thanks in advance for your discretion ;-)
Bob.