vehre / aspa_cscc

Convert ASP pages to "pure" html/JS/PHP pages. Based on ASPA with conversion of client side VBscript to Javascript
Other
5 stars 1 forks source link

Function parameters modified by reference #12

Open jhiswin opened 10 years ago

jhiswin commented 10 years ago
Sub subroutine(param)
param = 3
end sub

Emitting a JS comment (and/or a debugger breakpoint) when parameters are set would make the conversion process easier:

function subroutine(param) {
param = 3; debugger; //PARAMETER MODIFIED BY REFERENCE
}

Ideally this would be handled automatically, but that would be non-trivial, and in some cases may behave differently than intended or introduce performance penalties.

vehre commented 10 years ago

Possible designs are:

  1. function subroutine(byref) { byref.param = 3; }

subroutine({param: foo}); This will become ugly, when a lot of arguments are transported by ref.

  1. function subroutine(param) { param.byref = 3; }

param.byref = foo subroutine(param); foo = param.byref;

I personally do not like the second version. Please comment.