You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the rascal-shell: if you have defined a main module in the RASCAL.MF it will run the main() function or the function defined in the RASCAL.MF to run. It will also translate all command line args (-startAt 20) to keyword params for that main function (startAt = 20). (actually there are even more cases in the rascal-shell)
Run-as inside eclipse: there are no command line arguments, so no keyword parameters. We could pass environment flags? Or stuff from the run configuration? But for now, no keyword parameters.
I'm not so sure that should be passed into the list args? I quite like the parsing of arguments as kwargs, it's the same as most modern languages are doing (providing a getopt kind of interface).
In Eclipse the commandline args could be passed in a text box in the run configuration, just like this is done now for Java programs. Then we would have the same behavior for both instances.
Now I remember why I had this different calling convention in mind: it was already used in the original Rascal design document (2008-2009)! Here is one of the examples (starting at p28):
public void main(list[str] argv){
int N = toInt(argv[0]);
map[int,int] squares = {};
for(int I : [1 .. N]){
squares[I] = I * I;
}
println("Table of squares from 1 to ", N);
println(squares);
}
What happens when pushing
Run as ... Rascal Application
?The interpreter calls
main()
, but I remember that keyword parameters are handled by the interpreter (but how are they set?)Compiled code calls
main([])
, for reasons that I do not recall but it may be to get some similarity with Java'smain
.Any opinions which way to go?
The text was updated successfully, but these errors were encountered: