-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolved issue #326, supported command line arguments, added example program #336
Resolved issue #326, supported command line arguments, added example program #336
Conversation
…d example Wyvern program that demonstrate the usage of command line argument
…module cmdArgs under java platform. Updated example file examples/CommandLineArguments.wyv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good functionality but could you address the issues I brought up before merge?
tools/src/wyvern/stdlib/Globals.java
Outdated
@@ -65,6 +65,7 @@ private Globals() { } | |||
javaWhiteList.add("wyvern.stdlib.support.Sys.utils"); | |||
javaWhiteList.add("wyvern.stdlib.support.HashMapWrapper.hashmapwrapper"); | |||
javaWhiteList.add("wyvern.stdlib.support.ArrayWrapper.arr"); | |||
javaWhiteList.add("wyvern.stdlib.support.CommandLineUtils.utils"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this should not be on the javaWhiteList - using command line arguments is something that is potentially dangerous and not every module should be able to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just undo this edit?
private CommandLineUtils() { | ||
} | ||
|
||
public CommandLineUtils(String[] arguments) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This design--where there are two constructors, and this one is used only for its side effect on global variables--is hard to understand. It would be better to omit this constructor and instead just call convertToDynArrayList() from the interpreter's main function, passing the arguments.
return arguments.length; | ||
} | ||
|
||
private void convertToDynArrayList() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably shouldn't be named starting with "convert" - better to start with "set" since the main thing this function does is side-effect the global variable to hold the arguments.
…itted the CommandLineUtils constructors that accepts arguments, renamed convertToDynArrayList() function to setArgumentList().
…java, Omitted the CommandLineUtils constructors that accepts arguments, renamed convertToDynArrayList() function to setArgumentList()." This reverts commit 47c9004.
…itted the CommandLineUtils constructors that accepts arguments, renamed convertToDynArrayList() function to setArgumentList().
Looks good, thanks for the edits! |
Resolved issue #326, supported command line arguments, added example Wyvern program that demonstrates the usage of command line arguments.